|
led mike,
Not sure if these XML structures (schemas) change very often. They come from a company from Japan (from a division in Italy). I think they are pretty solid/permanent. Also, I'm not sure why they didn't provide schemas or DTDs either...
I am using the XmlTextWriter only because it is fast (not that speed is really and issue at this point). I used the XMLDocument object in a previous cXML project that was very similar to this project and it seemed a little slower to generate the xml docs. I just wanted to try the XmlTextWriter to see if it was noticably faster. It is also easier to use the XmlTextWriter in my code generator. I also thought about the StringBuilder and it work just as well probably. The XmlTextWriter has a fwe handly features like being able to close off the element and stuff like that.
Josh Blair
Evergreen, CO
|
|
|
|
|
I think I understand what you're talking about, although it doesn't make much sense. You take an XML document as input and create the code that will generate that XML document. I've never seen anything like that before, but I'm pretty sure you could just write one yourself using an XmlReader and a StringBuilder (or better yet - CodeDom).
|
|
|
|
|
Yes, the output from the code generator alone doesn't offer much by itself. So then, once I have the code that produces the XML document (an empty version with no invoice data), I add to that code. I add public properties with get and set accessors. I add the ablity to add line items to a "line itme collection", things like that. So from my code, I can grab all the data necessary that will eventually populate this document, then I instantiate this xml invoice business object filling its properties, collections, etc. Then i call a "create" method which generates a new xml document with the proper structure containing all the invoice data from my ERP system and other data sources. Am I approaching this bass-ackwards?
Thanks,
Josh Blair
Evergreen, CO
|
|
|
|
|
|
Dustin, thanks for the link. That is a pretty cool app. I tried it with my XML structures and it fails. I tweaked the app and my XML a bit an got it to run. That is a great sample. I'll see if the output is going to be useful and let you know.
I also tried running XSD.exe (mentioned in one of the comments to the article) over my XML samples. Here is the output:
C:\Projects\Customer_XMLCodeGenerator_CS>xsd CustomerDespatchAdvice.xml
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 1.1.4322.573]
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
Error: There was an error processing 'CustomerDespatchAdvice.xml'.
- The same table (Country) cannot be the child table in two nested relations.
(In this xml sample, there are multiple sections with the same element (Country), and the tool treats those as "tables" and 2 tables can't have the same name...)
I have run into this type of error before with other XML-based projects. I think what is basically going on is that the XSD tool determines that the XML data is not valid according to the ADO.NET schema inference rules. See the following article for more on this issue. Quite a limitation if you ask me. Not a big deal if you have the luxury of defining the XML data from the beginning but not cool if you are forced to use someone elses structure...
I had the same problem with cXML (http://www.cXML.org in another similar project)
http://support.microsoft.com/default.aspx?scid=kb;EN-US;325696
Anyway, thanks for the tip!
Josh Blair
Evergreen, CO
|
|
|
|
|
Glad that helped.
We had a similar problem at one of my previous jobs. We wanted to just take their XML format and dump it into a DataSet, but it didn't like the "duplicate" table names. And we couldn't change the format. They ended up creating custom classes that handled the serialization. The problem I had with that solution though was that there wasn't much code generation going on to create those custom classes and there were no unit tests to make sure they worked 100% correct. If there was ever a good place to use code generation...
|
|
|
|
|
Hi all,
I have a very weird problem:
I have a web page (myfeeder.asp) to generate very simple xml content. I use ie to navigate to the page, I can see the xml content on MOST of the pc. the xml like:
<?xml version="1.0"?>
<ads>
<ad>
content here.
</ad>
</ads>
My problem is, I CAN NOT get the xml content from some of web server's IE. what I got is nothing or just the structure, like below. It also happpends to some linux server.
<?xml version="1.0"?>
<ads>
<ad>
</ad>
</ads>
I know the server/pc that can not get the xml content is using re-writing.
I have no idea what cause the problem!!
Does any one have the same experience!!! Please help me to solve the problem!!!!
Thanks in advance!!
Alan Shen
MCAD for .NET Version
^~^~^~^~^~^~^~^~^~^~^
Great idea is the beginging of success!
-- modified at 23:04 Wednesday 24th May, 2006
|
|
|
|
|
Hi all first time caller ; long time listener;; haha ;Had to say that...
Here is my deal; i have worked with xml and schemas now on and off for about 16 months and i am just now really seeing the power of xsd and xml ....
I am modeling my class objects with the xsd designer in vs.net 2005 and then run the xsd.exe to produce my class obj;s in c#. When i am designing a complextype when needed i will create an unnamed simple type as an enum..
Here is my question? I need to design an xsd that will have complextype like.. MaterialType that has an element of blinds( here is where i need the help -->)that has a group OR enum of (WOOD, plastic, faux, ECT...); that has a group OR enum of ( 1/2", 1", 1/2", 2/1/2", ECT...) that has a group OR enum of (color, White, red, blue, stain( NOW even the colors may have a need for a group or enum like( LIGHT BLUE, ***** Prices can be base on color options that is why i need so many levels,, and (or) prices based on Wood or plactic..)))
I think everyone can see where i am going and i know this is a simple one for someone who has created a schema that will offer the most ease of development...
Can someone tell me if i need to work with the GROUP, ENUMS, ?????? Looking for any and all suggestion here?
Erik
|
|
|
|
|
I'd say that embedding things like colour, size etc as an enum is probably hard-coding too much - what happens when extra colours, sizes are added to the product range?
I would tend to use a relational database approach rather than multiple levels of hierarchy - define the range of colours, sizes etc separately and then link to them somehow (ids and id-refs, probably).
|
|
|
|
|
Thanks you for your help! Very much appreciated.
Erik
|
|
|
|
|
I did something similar where all my different enumerations were each a single simple string type - pen width, colors, line styles, etc. Then I made a complex object containing a sequence of elements where each element was one of the enumerated types, each type represented a single time.
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
I want to get some examples in ASP using XML that how connection has been created using XML in ASP / Javascript.
Please give me proper suggestions.
Thanx
Jesal Rana
OK
|
|
|
|
|
|
Please help me out to get a particuler value from XML document.
I want ti dril down in an XML doc to search for a value.
Urgent .
sanjeev
|
|
|
|
|
See XPath[^]
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
if i have to manager hundreds (maybe even thousands)of xml files, now i wanna offer my user a search function, is efficiency a serious problem f i use SAX or DOM to search for information the user query for? should i open the file just in plain text mode?
|
|
|
|
|
How will you take values for an insert statement
To insert the table values some values from one table and some values from open xml this will carried in a Stored Procedure
Help Please
Thanx
-
|
|
|
|
|
Please Help !!!!!!
I am using an xml file as my database . But I can't do insert, update and delete ops !!!
Pls give the code .
Thanks in advance ...........
|
|
|
|
|
|
I am new to XSL and I need help.
I have the following xml:
<Documents>
<Document>
<DocId>1</DocId>
<Status>1</Status>
<Page>1</Page>
</Document>
<Document>
<DocId>1</DocId>
<Status>1</Status>
<Page>2</Page>
</Document>
<Document>
<DocId>1</DocId>
<Status>2</Status>
<Page>1</Page>
</Document>
<Document>
<DocId>2</DocId>
<Status>1</Status>
<Page>1</Page>
</Document>
<Document>
<DocId>2</DocId>
<Status>2</Status>
<Page>1</Page>
</Document>
<Document>
<DocId>2</DocId>
<Status>3</Status>
<Page>1</Page>
</Document>
<Document>
<DocId>3</DocId>
<Status>1</Status>
<Page>1</Page>
</Document>
<Document>
<DocId>3</DocId>
<Status>1</Status>
<Page>2</Page>
</Document>
<Document>
<DocId>3</DocId>
<Status>1</Status>
<Page>3</Page>
</Document>
</Documents>
I have to sort the documents with DocId and Status. I would like to transform this xml to:
<Documents>
<Document>
<DocId>1</DocId>
<Pages>
<Page>
<Status>1</Status>
<Page>1</Page>
</Page>
<Page>
<Status>1</Status>
<Page>2</Page>
</Page>
</Pages>
</Document>
<Document>
<DocId>1</DocId>
<Pages>
<Page>
<Status>2</Status>
<Page>1</Page>
</Page>
</Pages>
</Document>
<Document>
<DocId>2</DocId>
<Pages>
<Page>
<Status>1</Status>
<Page>1</Page>
</Page>
</Pages>
</Document>
<Document>
<DocId>2</DocId>
<Pages>
<Page>
<Status>2</Status>
<Page>1</Page>
</Page>
</Pages>
</Document>
<Document>
<DocId>2</DocId>
<Pages>
<Page>
<Status>3</Status>
<Page>1</Page>
</Page>
</Pages>
</Document>
<Document>
<DocId>3</DocId>
<Pages>
<Page>
<Status>1</Status>
<Page>1</Page>
</Page>
<Page>
<Status>1</Status>
<Page>2</Page>
</Page>
<Page>
<Status>1</Status>
<Page>3</Page>
</Page>
</Pages>
</Document>
</Documents>
Please help!!!
Subbakka
|
|
|
|
|
I am new to XSL and I need help.
I have the following xml:
<documents>
<document>
<docid>1
<status>1
<page>1
<document>
<docid>1
<status>1
<page>2
<document>
<docid>1
<status>2
<page>1
<document>
<docid>2
<status>1
<page>1
<document>
<docid>2
<status>2
<page>1
<document>
<docid>2
<status>3
<page>1
<document>
<docid>3
<status>1
<page>1
<document>
<docid>3
<status>1
<page>2
<document>
<docid>3
<status>1
<page>3
I have to sort the documents with DocId and Status. I would like to transform this xml to:
<documents>
<document>
<docid>1
<pages>
<page>
<status>1
<page>1
<page>
<status>1
<page>2
<document>
<docid>1
<pages>
<page>
<status>2
<page>1
<document>
<docid>2
<pages>
<page>
<status>1
<page>1
<document>
<docid>2
<pages>
<page>
<status>2
<page>1
<document>
<docid>2
<pages>
<page>
<status>3
<page>1
<document>
<docid>3
<pages>
<page>
<status>1
<page>1
<page>
<status>1
<page>2
<page>
<status>1
<page>3
Please help!!!
Subbakka
|
|
|
|
|
You can modify the post rather than start a whole new one. This keeps the forum clean and free from clutter.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
<xml xmlns:x="urn:schemas-microsoft-com:office:excel">
<x:PivotTable>
<x:OWCVersion>11.0.0.6555</x:OWCVersion>
<x:NoDisplayAlerts/>
<x:DisplayScreenTips/>
<x:CubeProvider>msolap.2</x:CubeProvider>
<x:CacheDetails/>
<x:ConnectionString>Provider=MSOLAP.2;Integrated Security=SSPI;Persist Security Info=False;Location=C:\sales.cub;Initial Catalog=Sales;Client Cache Size=25;Auto Synch Period=10000;Log File=C:\log.txt</x:ConnectionString>
<x:DataMember>Sales</x:DataMember>
<x:Name>City Comparison of Drink Sales</x:Name>
<x:PivotField>
<x:Name>Country</x:Name>
<x:SourceName>[Customers].[Country]</x:SourceName>
<x:FilterCaption>Customers</x:FilterCaption>
<x:Orientation>Row</x:Orientation>
<x:CompareOrderedMembersBy>UniqueName</x:CompareOrderedMembersBy>
<x:AutoSortOrder>Descending</x:AutoSortOrder>
<x:Expanded/>
</x:PivotField>
<x:PivotField>
<x:Name>State Province</x:Name>
<x:SourceName>[Customers].[State Province]</x:SourceName>
<x:Orientation>Row</x:Orientation>
<x:Position>2</x:Position>
<x:CompareOrderedMembersBy>UniqueName</x:CompareOrderedMembersBy>
</x:PivotField>
<x:PivotField>
<x:Name>City</x:Name>
<x:SourceName>[Customers].[City]</x:SourceName>
<x:CompareOrderedMembersBy>UniqueName</x:CompareOrderedMembersBy>
</x:PivotField>
<x:PivotField>
<x:Name>Name</x:Name>
<x:SourceName>[Customers].[Name]</x:SourceName>
<x:CompareOrderedMembersBy>UniqueName</x:CompareOrderedMembersBy>
</x:PivotField>
<x:PivotField>
<x:Name>Gender</x:Name>
<x:SourceName>[Gender].[Gender]</x:SourceName>
<x:CompareOrderedMembersBy>UniqueName</x:CompareOrderedMembersBy>
</x:PivotField>
<x:PivotField>
<x:Name>Product Family</x:Name>
<x:SourceName>[Product].[Product Family]</x:SourceName>
<x:FilterCaption>Product</x:FilterCaption>
<x:CompareOrderedMembersBy>UniqueName</x:CompareOrderedMembersBy>
</x:PivotField>
<x:PivotField>
<x:Name>Product Department</x:Name>
<x:SourceName>[Product].[Product Department]</x:SourceName>
<x:CompareOrderedMembersBy>UniqueName</x:CompareOrderedMembersBy>
</x:PivotField>
<x:PivotField>
<x:Name>Product Category</x:Name>
<x:SourceName>[Product].[Product Category]</x:SourceName>
<x:CompareOrderedMembersBy>UniqueName</x:CompareOrderedMembersBy>
</x:PivotField>
<x:PivotField>
<x:Name>Product Subcategory</x:Name>
<x:SourceName>[Product].[Product Subcategory]</x:SourceName>
<x:CompareOrderedMembersBy>UniqueName</x:CompareOrderedMembersBy>
</x:PivotField>
<x:PivotField>
<x:Name>Brand Name</x:Name>
<x:SourceName>[Product].[Brand Name]</x:SourceName>
<x:CompareOrderedMembersBy>UniqueName</x:CompareOrderedMembersBy>
</x:PivotField>
<x:PivotField>
<x:Name>Product Name</x:Name>
<x:SourceName>[Product].[Product Name]</x:SourceName>
<x:CompareOrderedMembersBy>UniqueName</x:CompareOrderedMembersBy>
</x:PivotField>
<x:PivotField>
<x:Name>Year</x:Name>
<x:SourceName>[Time].[Year]</x:SourceName>
<x:FilterCaption>Time</x:FilterCaption>
<x:Orientation>Column</x:Orientation>
<x:CompareOrderedMembersBy>Name</x:CompareOrderedMembersBy>
<x:Expanded/>
</x:PivotField>
<x:PivotField>
<x:Name>Quarter</x:Name>
<x:SourceName>[Time].[Quarter]</x:SourceName>
<x:CompareOrderedMembersBy>Name</x:CompareOrderedMembersBy>
</x:PivotField>
<x:PivotField>
<x:Name>Month</x:Name>
<x:SourceName>[Time].[Month]</x:SourceName>
<x:CompareOrderedMembersBy>Name</x:CompareOrderedMembersBy>
</x:PivotField>
<x:PivotField>
<x:Name>Profit</x:Name>
<x:SourceName>[Measures].[Profit]</x:SourceName>
<x:SourceHierarchy>[Measures].[Profit]</x:SourceHierarchy>
</x:PivotField>
<x:PivotField>
<x:Name>Store Sales</x:Name>
<x:SourceName>[Measures].[Store Sales]</x:SourceName>
<x:SourceHierarchy>[Measures].[Store Sales]</x:SourceHierarchy>
</x:PivotField>
<x:PivotField>
<x:Name>Data</x:Name>
<x:Orientation>Column</x:Orientation>
<x:Position>-1</x:Position>
<x:DataField/>
</x:PivotField>
<x:PivotField>
<x:Name>Profit</x:Name>
<x:TotalNumber>0</x:TotalNumber>
<x:Orientation>Data</x:Orientation>
<x:Position>1</x:Position>
<x:ParentField>[Measures].[Profit]</x:ParentField>
</x:PivotField>
<x:PivotField>
<x:Name>Store Sales</x:Name>
<x:TotalNumber>4</x:TotalNumber>
<x:Orientation>Data</x:Orientation>
<x:Position>2</x:Position>
<x:ParentField>[Measures].[Store Sales]</x:ParentField>
</x:PivotField>
<x:PLTotal>
<x:Name>Sales Average</x:Name>
<x:TotalNumber>1</x:TotalNumber>
</x:PLTotal>
<x:PLTotal>
<x:Name>Sales Count</x:Name>
<x:TotalNumber>2</x:TotalNumber>
</x:PLTotal>
<x:PLTotal>
<x:Name>Store Cost</x:Name>
<x:TotalNumber>3</x:TotalNumber>
</x:PLTotal>
<x:PLTotal>
<x:Name>Store Sales Net</x:Name>
<x:TotalNumber>5</x:TotalNumber>
</x:PLTotal>
<x:PLTotal>
<x:Name>Unit Sales</x:Name>
<x:TotalNumber>6</x:TotalNumber>
</x:PLTotal>
<x:PivotView>
<x:IsNotFiltered/>
<x:Label>
<x:Caption>City Comparison of Drink Sales</x:Caption>
</x:Label>
</x:PivotView>
<x:PivotAxis>
<x:Orientation>Row</x:Orientation>
<x:DisplayEmptyMembers/>
</x:PivotAxis>
<x:PivotAxis>
<x:Orientation>Column</x:Orientation>
<x:DisplayEmptyMembers/>
</x:PivotAxis>
</x:PivotTable>
</xml>
This is my XML file and i m not getting the root element of this XML.I have to transform this file in to the XSL file and then shown on to the page using javascript.The Basic problem is that i m not getting the Root Element of this XML file.Please anybody help me as soon as possible.This XML is generated by the datasource of PivotTable i.e the OLAP tool.Actually i have to get the PivotField's Child element SourceName through which i again have to make an MDX Query.
Nitin Kale
-- modified at 4:26 Thursday 18th May, 2006
|
|
|
|
|
I want to get a hyperlink to display in an .aspx page the content of which
comes from loading an Xml document.
Cheers.
The XML document looks like this :
<FAQ>
<Answer>Go to the <a href=www.google.com>TEST</a> section to view details.</Answer>
</FAQ>
|
|
|
|
|
JoJuPi01 wrote: <answer>Go to the TEST section to view details.
you have to Write DTD file for same!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|