|
|
 |
| XML General XML discussions. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the XML section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

July 1st, 2009, 12:22 PM
|
|
Registered User
|
|
Join Date: Jun 2009
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Parse XML
Hi,
I'd like to parse XML inside XSD. I need to get dynamicly data from XML a build this dynamicly:
<xs:simpleType name="categories">
<xs:restriction base="xs:normalizedString">
<xs:enumeration value="from XML"/>
</xs:restriction>
</xs:simpleType>
Does anyone if I can do that? Otherwise any idea to do it different way...
Thanks in advance
|

July 1st, 2009, 12:28 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 1,359
Thanks: 0
Thanked 31 Times in 31 Posts
|
|
Please try to write a better question. We've no idea what you want - where is your XML, what does it look like, what are you using to 'process' the XSD?
Try looking at this post for help on how to write a good post: Hints for a good XSLT post
__________________
/- Sam Judson : Wrox Technical Editor -/
|

July 1st, 2009, 12:46 PM
|
|
Registered User
|
|
Join Date: Jun 2009
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Ok, I'm working with Alfresco. I have one field which is categories in a web form. The web form get the structure from XSD, so I'd like to get the values of that field dynamicly. Thus, I thought I could use parse a XML inside the XSD, this way I can get the values dynamicly. The type of categories would be SimpleType.
This my categories right now:
<xs:simpleType name="categories">
<xs:restriction base="xs:normalizedString">
<xs:enumeration value="Commnications"/>
<xs:enumeration value="Collaboration"/>
<xs:enumeration value="Academic"/>
<xs:enumeration value="Community"/>
<xs:enumeration value="Student Informations Systems"/>
<xs:enumeration value="Administrative Systems"/>
<xs:enumeration value="Career"/>
</xs:restriction>
</xs:simpleType>
I'd like to parse all the values from external file, so I don't know if I can do it. I've looked for soluctions in Internet, but I haven't found anything.
Can someone help me out with any way to solve this problem?
Thanks
PD: I'm sorry for last post
|

July 1st, 2009, 12:52 PM
|
 |
Wrox Author
Points: 12,735, Level: 48 |
|
|
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 3,923
Thanks: 0
Thanked 82 Times in 80 Posts
|
|
There's an enormous literature on managing code-lists but you seem to be looking for a cheap-and-cheerful solution. In that case you might like to use XML entities: write the schema as
Code:
<!DOCTYPE xs:schema [
<!ENTITY codelist "codes.xml"/>
]>
<xs:schema>
<xs:simpleType name="categories">
<xs:restriction base="xs:normalizedString">
&codelist;
</xs:restriction>
</xs:simpleType>
and parse it using a SAX parser with a custom EntityResolver. When the parser tries to find codes.xml it will call your EntityResolver and you can return anything you like.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
|
|
The Following User Says Thank You to mhkay For This Useful Post:
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |