Convert xml referenced entity to unicode?
Hi,
Anyone know how one converts all XML Referenced Entities, of the form "&#xxx;", which appear in a String object, to their unicode representation?
For example:
If String A contains the phrase "two letters: Á á", I would like to get a new String which contains the phrase "two letters: � �"
nobody71 wrote:
I can write some code to do the conversion by parsing the string, finding each and every XML reference and then convert each to unicode... I know how to do that...Then go ahead and do it.
but there must already be something that does this in Java's standard API/library...Actually there isn't.
For example, when this type of XML entity reference is found in the text of an XML node, and this node is read into a java DOM object using java's API/library, there is some code somewhere which does the conversion I am inquiring about, because when I view the String representing that text, it now contains the unicode characters. So, there must be a quick and already existing way to do this.The code must exist somewhere, yes. It doesn't follow that the code must be encapsulated in a public method. It's a specialized requirement of XML parsers so there's really no need to make it available outside the parsers where it exists.
I guess in the time it took me to write this post I could have written the converter... :-(Why do you need to do that, anyway? Why not just let an XML parser do it for you?
Similar Messages
-
How to convert xml utf 16 to utf 8
Is it possible to convert xml file with UTF16 to UTF8 using ABAP? I am using ECC 6.0
Appreciated your inputs.Hhmm, interesting. I thought it should be straightforward, but it the two solutions I could think of seem a bit convoluted. First way is probably to use the iXML libray, where the starting point is the class CL_IXML. You can find the SAP documentation [here|http://help.sap.com/saphelp_nw04/helpdata/en/86/8280d212d511d5991b00508b6b8b11/frameset.htm].
Then there's a "manual approach": Use OPEN DATASET to read the UTF-16 file, then modify the XML encoding attribute and save it as UTF-8 file. Not straightforward, because the tempting command option [OPEN DATASET .. LEGACY TEXT MODE CODE PAGE|http://help.sap.com/abapdocu_70/en/ABAPOPEN_DATASET_MODE.htm] doesn't work. Per ABAP help:
For the specification of the code page cp, a character-type data object is expected that must contain - at the time of execution of the statement - the label of a non-Unicode page from the column CPCODEPAGE in the database table TCP00. A Unicode page must not be specified.
Darn, looks like they expect most Unicode files to be UTF-8. But that might be the reason you want to convert it...
So use the following steps:
<ol><li>Open the file as a binary file (only option for UTF-16, seev[here|http://help.sap.com/abapdocu_70/en/ABAPOPEN_DATASET_ENCODING.htm]) via [OPEN DATASET file FOR INPUT IN BINARY MODE|http://help.sap.com/abapdocu_70/en/ABAPOPEN_DATASET.htm] and read content into XSTRING using [READ DATASET|http://help.sap.com/abapdocu_70/en/ABAPREAD_DATASET.htm].</li>
<li>Convert it to a string using utility class [CL_ABAP_CONV_IN_CE|http://help.sap.com/saphelp_nw04/helpdata/en/79/c554afb3dc11d5993800508b6b8b11/frameset.htm], see example [here|http://wiki.sdn.sap.com/wiki/display/Snippets/ABAPCodePage+Conversions].</li>
<li>Replace the encoding markup for UTF-16 in the XML with a reference to UTF-8.</li>
<li>Write the XML content back to a file using [OPEN DATASET file|http://help.sap.com/abapdocu_70/en/ABAPOPEN_DATASET.htm] FOR [OUTPUT|http://help.sap.com/abapdocu_70/en/ABAPOPEN_DATASET_ACCESS.htm] IN [TEXT MODE|http://help.sap.com/abapdocu_70/en/ABAPOPEN_DATASET_MODE.htm] [ENCODING UTF-8|http://help.sap.com/abapdocu_70/en/ABAPOPEN_DATASET_ENCODING.htm] and [TRANSFER|http://help.sap.com/abapdocu_70/en/ABAPTRANSFER.htm]</li></ol>
Maybe somebody has a shorter way...
Cheers, harald -
Need help converting BibleWorks Hebrew font to Unicode
Greetings all you InDesign scholars!
I am currently busy converting a print version of a book to e-book format. The difficulty I am having has to do with the way Adobe InDesign handles right-to-left fonts. The book on which I am working contains a lot of Hebrew because it is an intensive word-study of the Hebrew Bible.
When the InDesign document was first created from a Word Document, Adobe took all of the right-to-left Hebrew characters and flipped them around backwards. What a mess! My employer tells me that their solution was to manually go through the book and change every charater to bwhebb, the BibleWorks font. Yikes! This is not a unicode font, so when I export an XML file from InDesign to make an e-book, all of my Hebrew letters come out as garbled Roman letters and symbols. I'm trying to find a macro that will let me convert to a Unicode font so that we can quickly change things to export this file but WITHOUT inverting the letters.
Are any of you knowledgeable about this kind of problem?
Thank you!Yes, and ugh. That would have been a fine solution in 1994, but today there is no reason whatsoever to use legacy non-Unicode text encodings for languages like Hebrew. I've never used BibleWorks myself, but it's just like the stuff I face on a daily basis - many people who learned how to key non-Latin scripts in the 90s are reluctant to give up their legacy-encoding fonts, so after a few years of hassling my Lao and Cambodian translators, I just give in and write text conversion scripts for them (or custom keyboards that let them key in their preferred keyboard layout yet generate Unicode text).
I did a bit of digging around for you, and found that there are Word macros already written that will handle the BibleWorks -> Unicode conversion for you. I doubt that every single one of these steps will work for you, but in your shoes I'd
1) Export perfectly-styled text from InDesign to RTF (or go back and get that source Word doc)
2) Open RTF in Word
3) Use a Word macro to convert text from BibleWorks to Unicode (link to Youtube showing particulars including .exe download that is supposed to do the conversion for you)
4) Place RTF back into InDesign and clear overrides (or re-place Word doc and re-format)
If your book isn't already perfectly styled then that won't work for you. A Javascript could be developed to use in InDesign, and if I were a fast scripter I'd hammer it out for you. I am an abysmally slow scripter, or I'd be hammering away instead of posting. But it seems doable to me - if you already had tables showing the BibleScript encoding I might be able to just copy and paste into my scripts for converting similar old fonts to Unicode. -
Getting error while converting xml to xsd
I am getting error"The table (citeinfo) cannot be the child table to itself in nested relations"
at "http://www.flame-ware.com/products/xml-2-xsd/Default.aspx", while converting
xml into xsd so i can register.
Wherever citeinfo is there it is giving error.
Please look at bold and suggest solution
thank you
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE metadata SYSTEM "http://www.fgdc.gov/metadata/fgdc-std-001-1998.dtd">
<metadata>
<idinfo>
<citation>
*<citeinfo>(1)*<origin>MRF</origin>
<pubdate>20040512</pubdate>
<pubtime>09000000</pubtime>
<title>BAS_EASEMENT</title>
<edition>1</edition>
<geoform>vector digital data</geoform>
<serinfo>
<sername>One</sername>
<issue>One</issue>
</serinfo>
<pubinfo>
<pubplace>San Jose</pubplace>
<publish>CITY</publish>
</pubinfo>
<othercit>None</othercit>
<onlink>www.mrf.com</onlink>
<lworkcit>
*<citeinfo>(2)*<pubdate>20040512</pubdate>
<pubtime>09000000</pubtime>
<edition>1</edition>
<geoform>vector digital data</geoform>
<serinfo>
<sername>One</sername>
<issue>One</issue>
</serinfo>
<pubinfo>
<pubplace>San Jose</pubplace>
<publish>CITY</publish>
</pubinfo>
<othercit>None</othercit>
<onlink>www.mrf.com</onlink>
*</citeinfo>(2)*</lworkcit>
*</citeinfo>(1)*</citation>
<descript>
<abstract>Easement</abstract>
<purpose>E911 System</purpose>
<supplinf>None</supplinf>
</descript>
<timeperd>
<timeinfo>
<sngdate>
<caldate>20040512</caldate>
<time>09000000</time>
</sngdate>
</timeinfo>
<current>publication date</current>
</timeperd>
<status>
<progress>Complete</progress>
<update>As needed</update>
</status>
<spdom>
<bounding>
<westbc>
-122.339</westbc>
<eastbc>
-121.0716</eastbc>
<northbc>
37.4900</northbc>
<southbc>
36.9086</southbc>
</bounding>
</spdom>
<keywords>
<theme>
<themekt>Easement</themekt>
<themekey>Easement</themekey>
</theme>
<place>
<placekt>San Jose</placekt>
<placekey>San Jose</placekey>
</place>
<stratum>
<stratkt>None</stratkt>
<stratkey>None</stratkey>
</stratum>
<temporal>
<tempkt>None</tempkt>
<tempkey>None</tempkey>
</temporal>
</keywords>
<accconst>None</accconst>
<useconst>None</useconst>
<ptcontac>
<cntinfo>
<cntperp>
<cntper>Earl Harris</cntper>
<cntorg>City of San Jose</cntorg>
</cntperp>
<cntpos>Project Manager</cntpos>
<cntaddr>
<addrtype>Actual Address</addrtype>
<address>801 N 1 ST</address>
<city>San Jose</city>
<state>CA</state>
<postal>90000</postal>
<country>USA</country>
</cntaddr>
<cntvoice>408.277.5626</cntvoice>
<cnttdd>408.277.5626</cnttdd>
<cntfax>408.298.8382</cntfax>
<cntemail>[email protected]</cntemail>
<hours>9-5</hours>
<cntinst>None</cntinst>
</cntinfo>
</ptcontac>
<browse>
<browsen>None</browsen>
<browsed>None</browsed>
<browset>None</browset>
</browse>
<datacred>Unknown</datacred>
<secinfo>
<secsys>FGDC</secsys>
<secclass>Confidential</secclass>
<sechandl>Confidential Information</sechandl>
</secinfo>
<native>Microsoft Windows NT Version 4.0 (Build 1381) Service Pack 6; ESRI ArcCatalog 8.3.0.800</native>
<crossref>
*<citeinfo>(3)*<origin>MRF</origin>
<pubdate>20040512</pubdate>
<pubtime>09000000</pubtime>
<title>BAS_EASEMENT</title>
<edition>1</edition>
<geoform>vector digital data</geoform>
<serinfo>
<sername>one</sername>
<issue>one</issue>
</serinfo>
<pubinfo>
<pubplace>San Jose</pubplace>
<publish>CITY</publish>
</pubinfo>
<othercit>None</othercit>
<onlink>www.mrf.com</onlink>
<lworkcit>
*<citeinfo>(*4)
<origin>MRF</origin>
<pubdate>20040512</pubdate>
<pubtime>09000000</pubtime>
<title>BAS_EASEMENT</title>
<edition>1</edition>
<geoform>vector digital data</geoform>
<serinfo>
<sername>one</sername>
<issue>one</issue>
</serinfo>
<pubinfo>
<pubplace>San Jose</pubplace>
<publish>CITY</publish>
</pubinfo>
<othercit>None</othercit>
<onlink>www.mrf.com</onlink>
*</citeinfo>(*3)
</lworkcit>
*</citeinfo*>(4)
</crossref>
</idinfo>
<dataqual>
<attracc>
<attraccr>All the related attributes are populated 100%.</attraccr>
<qattracc>
<attraccv>100%</attraccv>
<attracce>All the related attributes are populated 100%.</attracce>
</qattracc>
</attracc>
<logic>100% adjusted,modified and captured easements.</logic>
<complete>100%</complete>
<posacc>
<horizpa>
<horizpar>Easement accuracy is 2 ft for 3" pixel Orthophoto, 5 ft for 9" pixel Orthophoto.</horizpar>
<qhorizpa>
<horizpav>2 ft for 3" pixel Orthophoto, 5 ft for 9" pixel Orthophoto.</horizpav>
<horizpae>Easement accuracy is 2 ft for 3" pixel Orthophoto, 5 ft for 9" pixel Orthophoto.</horizpae>
</qhorizpa>
</horizpa>
<vertacc>
<vertaccr>Easement accuracy is 2 ft for 3" pixel Orthophoto, 5 ft for 9" pixel Orthophoto.</vertaccr>
<qvertpa>
<vertaccv>2 ft for 3" pixel Orthophoto, 5 ft for 9" pixel Orthophoto.</vertaccv>
<vertacce>Easement accuracy is 2 ft for 3" pixel Orthophoto, 5 ft for 9" pixel Orthophoto.</vertacce>
</qvertpa>
</vertacc>
</posacc>
<lineage>
<srcinfo>
<srccite>
<*citeinfo>(5)*<origin>MRF</origin>
<pubdate>20040512</pubdate>
<pubtime>09000000</pubtime>
<title>BAS_EASEMENT</title>
<edition>1</edition>
<geoform>vector digital data</geoform>
<serinfo>
<sername>one</sername>
<issue>one</issue>
</serinfo>
<pubinfo>
<pubplace>San Jose</pubplace>
<publish>CITY</publish>
</pubinfo>
<othercit>None</othercit>
<onlink>www.mrf.com</onlink>
<lworkcit>
*</citeinfo>(5*)*<citeinfo>(6)*
<origin>MRF</origin>
<pubdate>20040512</pubdate>
<pubtime>09000000</pubtime>
<title>BAS_EASEMENT</title>
<edition>1</edition>
<geoform>vector digital data</geoform>
<serinfo>
<sername>one</sername>
<issue>one</issue>
</serinfo>
<pubinfo>
<pubplace>San Jose</pubplace>
<publish>CITY</publish>
</pubinfo>
<othercit>None</othercit>
<onlink>www.mrf.com</onlink>
*</citeinfo>(5)*
</lworkcit>
*</citeinfo>(6)*
</srccite>
<srcscale>24000</srcscale>
<typesrc>FTP</typesrc>
<srctime>
<timeinfo>
<sngdate>
<caldate>20040512</caldate>
<time>09000000</time>
</sngdate>
</timeinfo>
<srccurr>publication date</srccurr>
</srctime>
<srccitea>Unknown</srccitea>
<srccontr>MGE dgn contains easement data.</srccontr>
</srcinfo>
<procstep>
<procdesc>Easement data is reprojected from NAD27 to NAD83.
Further it is adjusted as per the spatial alignment shown in MGE input dgn.</procdesc>
<srcused>Easement</srcused>
<procdate>20040512</procdate>
<proctime>09000000</proctime>
<srcprod>BAS_EASEMENT</srcprod>
<proccont>
<cntinfo>
<cntperp>
<cntper>Mahesh P Choudhury</cntper>
<cntorg>Rolta International Inc.</cntorg>
</cntperp>
<cntpos>Project Manager</cntpos>
<cntaddr>
<addrtype>mailing address</addrtype>
<address>5865 North Point Parkway</address>
<city>Alpharetta</city>
<state>GA</state>
<postal>30022</postal>
<country>USA</country>
</cntaddr>
<cntvoice>678.942.5015</cntvoice>
<cnttdd>678.942.5015</cnttdd>
<cntfax>678.942.5001</cntfax>
<cntemail>[email protected]</cntemail>
<hours>8-5</hours>
<cntinst>None</cntinst>
</cntinfo>
</proccont>
</procstep>
</lineage>
<cloud>Unknown</cloud>
</dataqual>
<spdoinfo>
<indspref>unknown</indspref>
<direct>Vector</direct>
<ptvctinf>
<sdtsterm>
<sdtstype>String</sdtstype>
<ptvctcnt>2203</ptvctcnt>
</sdtsterm>
</ptvctinf>
</spdoinfo>
<spref>
<horizsys>
<geograph>
<latres>5.5</latres>
<longres>5.5</longres>
<geogunit>Decimal degrees</geogunit>
</geograph>
<geodetic>
<horizdn>North American Datum of 1983</horizdn>
<ellips>Geodetic Reference System 80</ellips>
<semiaxis>1</semiaxis>
<denflat>2</denflat>
</geodetic>
</horizsys>
<vertdef>
<altsys>
<altdatum>North American Vertical Datum of 1988</altdatum>
<altres>0.002</altres>
<altunits>sf</altunits>
<altenc>Attribute values</altenc>
</altsys>
<depthsys>
</depthsys>
</vertdef>
</spref>
<eainfo>
<detailed>
<enttyp>
<enttypl>
BAS_EASEMENT</enttypl>
<enttypd>Contains geometry and attributes for easement segments</enttypd>
<enttypds>Data Model Dictionary</enttypds>
</enttyp>
<attr>
<attrlabl>BAS_EASEMENT_ID</attrlabl>
<attrdef>Migrated from STREET table ID column. After all the existing IDs have been migrated, assign ID #70,001 onwards for the new easement (or what ever # is available sequentially using, street centerline #) ID's.</attrdef>
<attrdefs>ESRI</attrdefs>
<attrdomv>
<udom>Sequential unique whole numbers that are automatically generated.</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>SURVEY_LENGTH</attrlabl>
<attrdef>Actual length of easement (international foot).This DOES take into account the State Plane Coordinate System.</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>Surveyed segment length</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>ROW_WIDTH</attrlabl>
<attrdef>Width of right-of-way (international feet)</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>Right-of-way width</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Updated from ROW files</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>FROM_EASEMENT_ID</attrlabl>
<attrdef>Self-referential key to BAS_EASEMENT table, that contains locational information about the easement that the easement is digitized from. "FROM" is the starting point of digitization</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>IDs of an easement to which FROM side of this easement is connected.</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>FROM_STREET_ID</attrlabl>
<attrdef>Foreign key to BAS_STREET_SEGMENT table, that contains locational information about street segment that the easement is digitized from. "FROM" is the starting point of digitization</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>IDs of an street segment to which FROM side of this easement is connected.</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>TO_EASEMENT_ID</attrlabl>
<attrdef>Self-referential key to BAS_EASEMENT table, that contains locational information about the easement that the easement is digitized to. "TO" is the ending point of digitization.</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>IDs of an easement to which TO side of this easement is closely located.</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>TO_STREET_ID</attrlabl>
<attrdef>Foreign key to BAS_STREET_SEGMENT table, that contains locational information about street segment that the easement is digitized to. "TO" is the ending point of digitization.</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>IDs of an street segment to which TO side of this easement is closely located.</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>OTH_PROCESSING_STATUS_ID</attrlabl>
<attrdef>ID of the status/result of last run batch job.</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>Migrated from PLAN_1 in MGE tables and GIS_TRACKING.MDB Access Database</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>MUNICIPALITY_NAME</attrlabl>
<attrdef>Name of municipality in which the easement primarily resides.</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<codesetd>
<codesetn>MUNICIPALITY_NAME_DOMAIN</codesetn>
<codesets>Data Model Dictionary</codesets>
</codesetd>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Updated using Municipal boundary source data.</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>RECORD_DRAWING_FLAG</attrlabl>
<attrdef>Engineering plan that has been accepted by the City of San Jose (Y or N).</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>USERNAME who last modified this record</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Updated using source data.</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>ACQUISITION_DATE</attrlabl>
<attrdef>Official date engineering plan accepted by the City of San Jose on this date</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>Date/Time stamp of last record modification</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Updated using source data.</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>GEO_MOD_DATE</attrlabl>
<attrdef>Time stamp when GEOMETRY column was last modified.</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>Time stamp when GEOMETRY column was last modified.</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Data modified date.</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>GDO_GEOMETRY</attrlabl>
<attrdef>Contains spatial data with true arc geometry.</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>Oracle Spatial Geometry Data - True Arcs</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>MAN_OVERRIDE</attrlabl>
<attrdef>This flag is 'N' by default. If this flag is set to 'Y' no unattended batch process will touch it ever again.</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>Flag set for batch process</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>MESSAGE</attrlabl>
<attrdef>Message from automated batch process to operator; can be "OK", or error message, or "to be checked", etc.</attrdef>
<attrdefs>data model dictionary</attrdefs>
<attrdomv>
<udom>GDO_GEOMETRY.LEN</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>OTH_PLAN_CREATED</attrlabl>
<attrdef>PLAN_1 in STREET table should be migrated to BAS_EASEMENT table OTH_PLAN_ID_CREATED column. This value should also be entered into the OTH_PLAN table PLAN_NAME column if not present.</attrdef>
<attrdefs>Data Dictionary</attrdefs>
<attrdomv>
<codesetd>
<codesetn>OTH_PLAN_DOMAIN</codesetn>
<codesets>data model dictionary</codesets>
</codesetd>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>OTH_PLAN_MODIFIED</attrlabl>
<attrdef>PLAN_2 in STREET table should be migrated to BAS_EASEMENT table OTH_PLAN_ID_MODIFIED column. This value should also be entered into the OTH_PLAN table PLAN_NAME column if not present</attrdef>
<attrdefs>Data dictionary</attrdefs>
<attrdomv>
<codesetd>
<codesetn>OTH_PLAN_DOMAIN</codesetn>
<codesets>data model dictionary</codesets>
</codesetd>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>LINEAGE_ID</attrlabl>
<attrdef>Artificial Numeric Identifier; Assigned to any graphical object; Unique throughout the system. Shared among tables. This column would also be used by EDL Administrator for lineage.</attrdef>
<attrdefs>Data dictionary</attrdefs>
<attrdomv>
<udom>Artificial Numeric Identifier</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>GDO_GEOMETRY.LEN</attrlabl>
<attrdef>Created default</attrdef>
<attrdefs>Data model</attrdefs>
<attrdomv>
<udom>unknown</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
</detailed>
<overview>
<eaover>Populated using MRF Tools</eaover>
<eadetcit>Various sources</eadetcit>
</overview>
</eainfo>
<distinfo>
<distrib>
<cntinfo>
<cntperp>
<cntper>Earl Harris</cntper>
<cntorg>City of San Jose</cntorg>
</cntperp>
<cntpos>Project Manager</cntpos>
<cntaddr>
<addrtype>Actual Address</addrtype>
<address>801 N 1 ST</address>
<city>San Jose</city>
<state>CA</state>
<postal>90000</postal>
<country>USA</country>
</cntaddr>
<cntvoice>408.277.5626</cntvoice>
<cnttdd>408.277.5626</cnttdd>
<cntfax>408.298.8382</cntfax>
<cntemail>[email protected]</cntemail>
<hours>9-5</hours>
<cntinst>None</cntinst>
</cntinfo>
</distrib>
<resdesc>Unknown</resdesc>
<distliab>Unknown</distliab>
<stdorder>
<digform>
<digtinfo>
<formname>GM Pro Access</formname>
<formvern>5.1</formvern>
<formspec>GM Pro 5.1</formspec>
<formcont>Easement data</formcont>
<filedec>no compression applied</filedec>
<transize>60</transize>
</digtinfo>
<digtopt>
<onlinopt>
<computer>
<networka>
<networkr>FTP</networkr>
</networka>
</computer>
<accinstr>FTP</accinstr>
<oncomp>FTP server</oncomp>
</onlinopt>
<offoptn>
<offmedia>None</offmedia>
<reccap>
<recden>1</recden>
<recdenu>None</recdenu>
</reccap>
<recfmt>None</recfmt>
<compat>None</compat>
</offoptn>
</digtopt>
</digform>
<fees>Unknown</fees>
<ordering>Unknown</ordering>
<turnarnd>Unknown</turnarnd>
</stdorder>
<custom>Unknown</custom>
<techpreq>Unknown</techpreq>
<availabl>
<timeinfo>
<sngdate>
<caldate>20040512</caldate>
<time>09000000</time>
</sngdate>
</timeinfo>
</availabl>
</distinfo>
<metainfo>
<metd>20040512</metd>
<metrd>20040512</metrd>
<metfrd>20040519</metfrd>
<metc>
<cntinfo>
<cntperp>
<cntper>Mahesh P Choudhury</cntper>
<cntorg>Rolta International Inc</cntorg>
</cntperp>
<cntpos>Project Manager</cntpos>
<cntaddr>
<addrtype>mailing address</addrtype>
<address>5865 North Point Parkway</address>
<city>Alpharetta</city>
<state>GA</state>
<postal>30022</postal>
<country>USA</country>
</cntaddr>
<cntvoice>678.942.5015</cntvoice>
<cnttdd>678.942.5015</cnttdd>
<cntfax>678.942.5001</cntfax>
<cntemail>[email protected]</cntemail>
<hours>8-5</hours>
<cntinst>None</cntinst>
</cntinfo>
</metc>
<metstdn>FGDC Content Standards for Digital Geospatial Metadata</metstdn>
<metstdv>FGDC-STD-001-1998</metstdv>
<mettc>local time</mettc>
<metac>Unknown</metac>
<metuc>Unknown</metuc>
<metsi>
<metscs>Unknown</metscs>
<metsc>Confidential</metsc>
<metshd>Unknown</metshd>
</metsi>
<metextns>
<onlink>http://www.esri.com/metadata/esriprof80.html</onlink>
<metprof>ESRI Metadata Profile</metprof>
</metextns>
</metainfo>
</metadata>I am having error while registering as undefined element for citeinfo, timeinfo and cntinfo as shown below
Please could you help me solve.
thanks
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:complexType name="citationType">
<xs:sequence>
*<xs:element ref="citeinfo"/>*
</xs:sequence>
</xs:complexType>
SQL> BEGIN
2 DBMS_XMLSCHEMA.registerSchema(
3 SCHEMAURL => 'fgdc-std-001-1998-sect011.xsd',
4 SCHEMADOC => bfilename('XMLDIR','fgdc-std-001-1998-sect011.xsd'),
5 CSID => nls_charset_id('UTF8'));
6 END;
7 /
BEGIN
ERROR at line 1:
ORA-31154: invalid XML document
ORA-19202: Error occurred in XML processing
LSX-00021: undefined element "citeinfo"
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 37
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 61
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 126
ORA-06512: at line 2
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:complexType name="timeperdType">
<xs:sequence>
*<xs:element ref="timeinfo"/> *
<xs:element ref="current"/>
</xs:sequence>
</xs:complexType>
<xs:element name="current" type="currentType">
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:complexType name="ptcontacType">
<xs:sequence>
*<xs:element ref="cntinfo"/> *
</xs:sequence>
</xs:complexType>
<xs:element name="browse" type="browseType">
<xs:annotation> -
How to convert XML file to an internal table ?
Hi All,
I want to do a batch input program. The source data would be given as an excel file . I would like to know how to convert XML file to internal table properly. Please help me out..
Thanking you in advance ..
Shankara Narayanan T.VHi Shankar,
use 'ALSM_EXCEL_TO_INTERNAL_TABLE' FM.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file1
i_begin_col = '1'
i_begin_row = '5'
i_end_col = '40'
i_end_row = '16'
TABLES
intern = it_intern
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT it_intern.
AT NEW row.
CLEAR it_intern.
ENDAT.
CASE lv_flag.
Production Version
WHEN 1.
it_master-matnr = it_intern-value.
WHEN 2.
it_master-werks = it_intern-value.
WHEN 3.
it_master-verid = it_intern-value.
WHEN 4.
it_master-text1 = it_intern-value.
WHEN 5.
it_master-fdate = it_intern-value.
AT END OF row.
APPEND it_master.
ENDAT.
ENDLOOP.
-Anu
Message was edited by:
Anupama Reddy -
Dear friends
For converting XML file to SAP, I used TEXT_CONVERT_XML_TO_SAP function module. In this I have some doubt. Pls clarify this.
1. I am getting run time error with type h.
2 I_FIELD_SEPERATOR = ';'
I_LINE_HEADER =
I_TAB_RAW_DATA =
I_FILENAME =
I_TOTALSIZE =
for the above parameter what are the value has to passed.
Thanks.Hi,
Take a look in this code:
*& Report z_xit_xml_check
REPORT z_xit_xml_check.
TYPE-POOLS: ixml.
DATA: BEGIN OF t_cabec OCCURS 0.
INCLUDE STRUCTURE zmmt2010.
DATA END OF t_cabec.
DATA: BEGIN OF t_item OCCURS 0.
INCLUDE STRUCTURE zmmt2011.
DATA END OF t_item.
DATA: BEGIN OF t_itemt OCCURS 0.
INCLUDE STRUCTURE zmmt2012.
DATA END OF t_itemt.
TYPES: BEGIN OF t_xml_line,
data(256) TYPE x,
END OF t_xml_line.
DATA check_item(1).
DATA check_itemt(1).
DATA: l_ixml TYPE REF TO if_ixml,
l_streamfactory TYPE REF TO if_ixml_stream_factory,
l_parser TYPE REF TO if_ixml_parser,
l_istream TYPE REF TO if_ixml_istream,
l_document TYPE REF TO if_ixml_document,
l_node TYPE REF TO if_ixml_node,
l_xmldata TYPE string.
DATA: l_elem TYPE REF TO if_ixml_element,
l_root_node TYPE REF TO if_ixml_node,
l_next_node TYPE REF TO if_ixml_node,
l_name TYPE string,
l_iterator TYPE REF TO if_ixml_node_iterator.
DATA: l_xml_table TYPE TABLE OF t_xml_line,
l_xml_line TYPE t_xml_line,
l_xml_table_size TYPE i.
DATA: l_filename TYPE string.
PARAMETERS: pa_file TYPE char1024 DEFAULT 'c:\xml.xml'.
START-OF-SELECTION.
PERFORM busca_xml.
PERFORM carrega_tabela.
*& Form get_xml_table
FORM get_xml_table CHANGING l_xml_table_size TYPE i
l_xml_table TYPE STANDARD TABLE.
Local variable declaration
DATA: l_len TYPE i,
l_len2 TYPE i,
l_tab TYPE tsfixml,
l_content TYPE string,
l_str1 TYPE string,
c_conv TYPE REF TO cl_abap_conv_in_ce,
l_itab TYPE TABLE OF string.
l_filename = pa_file.
upload a file from the client's workstation
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_filename
filetype = 'BIN'
IMPORTING
filelength = l_xml_table_size
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. "get_xml_table
*& Form process_dom
FORM process_dom USING document TYPE REF TO if_ixml_document.
DATA: node TYPE REF TO if_ixml_node,
iterator TYPE REF TO if_ixml_node_iterator,
nodemap TYPE REF TO if_ixml_named_node_map,
attr TYPE REF TO if_ixml_node,
name TYPE string,
prefix TYPE string,
value TYPE string,
indent TYPE i,
count TYPE i,
index TYPE i.
DATA v_codcat TYPE zmmt2011-codcat.
DATA v_master_for TYPE zmmt2011-master_for.
node ?= document.
CHECK NOT node IS INITIAL.
IF node IS INITIAL. EXIT. ENDIF.
create a node iterator
iterator = node->create_iterator( ).
get current node
node = iterator->get_next( ).
loop over all nodes
WHILE NOT node IS INITIAL.
indent = node->get_height( ) * 2.
indent = indent + 20.
CASE node->get_type( ).
WHEN if_ixml_node=>co_node_element.
element node
name = node->get_name( ).
TRANSLATE name TO LOWER CASE.
IF name = 'iten'.
MOVE 'I' TO check_item.
ENDIF.
IF name = 'cabec'.
MOVE 'C' TO check_item.
ENDIF.
IF name = 'iten_texto'.
MOVE 'T' TO check_item.
ENDIF.
nodemap = node->get_attributes( ).
IF NOT nodemap IS INITIAL.
attributes
count = nodemap->get_length( ).
DO count TIMES.
index = sy-index - 1.
attr = nodemap->get_item( index ).
name = attr->get_name( ).
prefix = attr->get_namespace_prefix( ).
value = attr->get_value( ).
ENDDO.
ENDIF.
WHEN if_ixml_node=>co_node_text OR
if_ixml_node=>co_node_cdata_section.
text node
value = node->get_value( ).
IF check_item = 'C'.
TRANSLATE name TO LOWER CASE.
CASE name.
WHEN 'lifnr'. MOVE value TO t_cabec-lifnr.
WHEN 'codcat'.
MOVE value TO t_cabec-codcat.
MOVE value TO v_codcat.
WHEN 'bukrs'. MOVE value TO t_cabec-bukrs.
WHEN 'zterm'. MOVE value TO t_cabec-zterm.
WHEN 'waers'. MOVE value TO t_cabec-waers.
WHEN 'inco1'. MOVE value TO t_cabec-inco1.
WHEN 'inco2'. MOVE value TO t_cabec-inco2.
WHEN 'telf1'. MOVE value TO t_cabec-telf1.
WHEN 'verkf'. MOVE value TO t_cabec-verkf.
WHEN 'datav'.
MOVE value TO t_cabec-datav.
APPEND t_cabec.
ENDCASE.
ENDIF.
IF check_item = 'I'.
TRANSLATE name TO LOWER CASE.
CASE name.
WHEN 'master_for'.
MOVE value TO t_item-master_for.
MOVE value TO v_master_for.
WHEN 'werks'. MOVE value TO t_item-werks.
WHEN 'versao'. MOVE value TO t_item-versao.
WHEN 'matkl'. MOVE value TO t_item-matkl.
WHEN 'j_1bindus3'. MOVE value TO t_item-j_1bindus3.
WHEN 'j_1bmatuse'. MOVE value TO t_item-j_1bmatuse.
WHEN 'j_1bmatorg'. MOVE value TO t_item-j_1bmatorg.
WHEN 'j_1bnbmco1'. MOVE value TO t_item-j_1bnbmco1.
WHEN 'bsgru'. MOVE value TO t_item-bsgru.
WHEN 'ekgrp'. MOVE value TO t_item-ekgrp.
WHEN 'txz01'. MOVE value TO t_item-txz01.
WHEN 'epstp'. MOVE value TO t_item-epstp.
WHEN 'netpr'. MOVE value TO t_item-netpr.
WHEN 'peinh'. MOVE value TO t_item-peinh.
WHEN 'meins'. MOVE value TO t_item-meins.
WHEN 'plifz'. MOVE value TO t_item-plifz.
WHEN 'mwskz'. MOVE value TO t_item-mwskz.
WHEN 'steuc'.
MOVE value TO t_item-steuc.
MOVE v_codcat TO t_item-codcat.
APPEND t_item.
ENDCASE.
ENDIF.
IF check_item = 'T'.
TRANSLATE name TO LOWER CASE.
CASE name.
WHEN 'linha'. MOVE value TO t_itemt-linha.
WHEN 'txlng'. MOVE value TO t_itemt-txlng.
MOVE v_master_for TO t_itemt-master_for.
MOVE v_codcat TO t_itemt-codcat.
append t_itemt.
ENDCASE.
ENDIF.
ENDCASE.
advance to next node
node = iterator->get_next( ).
ENDWHILE.
ENDFORM. "process_dom
*& Form Busca_XML
text
--> p1 text
<-- p2 text
FORM busca_xml .
DATA: lc_mess(70) TYPE c,lv_tab.
TYPES: BEGIN OF ty_zvmsgorgtr.
INCLUDE STRUCTURE zmmt2011.
TYPES END OF ty_zvmsgorgtr.
Creating the main iXML factory
l_ixml = cl_ixml=>create( ).
Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
PERFORM get_xml_table CHANGING l_xml_table_size l_xml_table.
wrap the table containing the file into a stream
l_istream = l_streamfactory->create_istream_itable( table =
l_xml_table size = l_xml_table_size ).
Creating a document
l_document = l_ixml->create_document( ).
Create a Parser
l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
istream = l_istream
document = l_document ).
Parse the stream
IF l_parser->parse( ) NE 0.
IF l_parser->num_errors( ) NE 0.
DATA: parseerror TYPE REF TO if_ixml_parse_error,
str TYPE string,
i TYPE i,
count TYPE i,
index TYPE i.
count = l_parser->num_errors( ).
WRITE: count, ' parse errors have occured:'.
index = 0.
WHILE index < count.
parseerror = l_parser->get_error( index = index ).
i = parseerror->get_line( ).
WRITE: 'line: ', i.
i = parseerror->get_column( ).
WRITE: 'column: ', i.
str = parseerror->get_reason( ).
WRITE: str.
index = index + 1.
ENDWHILE.
ENDIF.
ENDIF.
ENDFORM. " Busca_XML
*& Form Carrega_Tabela
text
--> p1 text
<-- p2 text
FORM carrega_tabela .
Process the document
IF l_parser->is_dom_generating( ) EQ 'X'.
PERFORM process_dom USING l_document.
ENDIF.
ENDFORM. " Carrega_Tabela -
Converted XML not showing multiple data entries correctly
Hello
I am creating a PDF Form from a xsd scheme but when I have data that could require multiple entries the converted xml is a mess. I am curently trying to create a way to add fields for multiple children. I created an expanding table and the fields are automatically copied when I click on „+“ or are deleted when I click on „-“ . If I have multiple rows for children then the converted xml looks like this :
The correct xml for multiple data entries should look like this (this is from a xml scheme not made in LiveCycle) :
Even if I copy the fields without creating a table, the converted xml is still a mess just like on the first image. Is there a way to show the xml from the PDF from correctly. I linked the xsd scheme that I am using for the PDF form: https://drive.google.com/file/d/0B30LkLSwYgB4SFN5bTkyLW1fOVU/edit?usp=sharing
Best regards
IvicaHello
I am creating a PDF Form from a xsd scheme but when I have data that could require multiple entries the converted xml is a mess. I am curently trying to create a way to add fields for multiple children. I created an expanding table and the fields are automatically copied when I click on „+“ or are deleted when I click on „-“ . If I have multiple rows for children then the converted xml looks like this :
The correct xml for multiple data entries should look like this (this is from a xml scheme not made in LiveCycle) :
Even if I copy the fields without creating a table, the converted xml is still a mess just like on the first image. Is there a way to show the xml from the PDF from correctly. I linked the xsd scheme that I am using for the PDF form: https://drive.google.com/file/d/0B30LkLSwYgB4SFN5bTkyLW1fOVU/edit?usp=sharing
Best regards
Ivica -
Problem in converting XML to XML file
Hi,
I am trying to convert xml file to another xml through command-line interface but failed.
java oracle.xml.parser.v2.oraxsl data.xml data.xsl data_new.xml
My xml and xsl files are:
1. XML file
<employee_data>
<employee_row>
<employee_number>7950</employee_number>
<employee_name>ABC</employee_name>
<employee_title>PRESIDENT</employee_title>
<manager>1111</manager>
<date_of_hire>20-JAN-93</date_of_hire>
<salary>65000</salary>
<commission>1000</commission>
<department_number>10</department_number>
</employee_row>
</employee_data>
2-1 XSL file
<?xml version="1.0" ?>
<xsl:stylesheet xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates>
<xsl:sort select=".//employee_name"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
2-2 XSL file
<?xml version = "1.0"?>
<ROWSET xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:for-each select="employee_data/employee_row">
<ROW>
<EMPNO><xsl:value-of select="employee_number"/></EMPNO>
<ENAME><xsl:value-of select="employee_name"/></ENAME>
<JOB><xsl:value-of select="employee_title"/></JOB>
<MGR><xsl:value-of select="manager"/></MGR>
<HIREDATE><xsl:value-of select="date_of_hire"/></HIREDATE>
<SAL><xsl:value-of select="salary"/></SAL>
<COMM><xsl:value-of select="commission"/></COMM>
<DEPTNO><xsl:value-of select="department_number"/></DEPTNO>
</ROW>
</xsl:for-each>
</ROWSET>
I used two xsl file to test but received same error message:
Error occurred while processing data.xsl: Error in expression: '*|/'.
Does anyone know how to fix the problem? I'll appreciate it very much for your help.
Thanks.
YiHi,
I have only tried it out with XML Spy, but anyway:
there seems to be an error in your 2-1 XSl file in line 2:
the correct stylesheet declaration is:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
You had an empty namespace and a wrong version attribute...
HTH,
Bernhard -
Hi,
I am using apache's FOP 0.20.3, xerces 2.0.0.beta4 and xalan j.2.2.0 to convert xml/xsl file to pdf. The code is same as the one given in the org.apache.fop.apps.Driver class.
<pre>
Driver driver = new Driver();
driver.setRenderer(Driver.RENDER_PDF);
InputHandler inputHandler = new XSLTInputHandler(new File(xmlFile), new File(xslFile));
try
XMLReader parser = inputHandler.getParser();
driver.setOutputStream(new FileOutputStream(outFile));
driver.render(parser, inputHandler.getInputSource());
catch (FOPException fope)
fope.printStackTrace();
catch (FileNotFoundException fnfe)
fnfe.printStackTrace();
</pre>
The xml and xsl files I am using are glossary.xml and glossary.xsl files that come with FOP.
Now, this code compiles successfully and while running gives the following exception:
<pre>
[ERROR]: Logger not set
[INFO]: building formatting object tree
[INFO]: [1]
org.apache.fop.apps.FOPException: java.lang.NullPointerException
at org.apache.fop.apps.Driver.render(Driver.java:486)
at XmlToPdf2.<init>(XmlToPdf2.java:28)
at XmlToPdf2.main(XmlToPdf2.java:42)
java.lang.RuntimeException: java.lang.NullPointerException
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1132)
at org.apache.xalan.transformer.TrAXFilter.parse(TrAXFilter.java:134)
at org.apache.fop.apps.Driver.render(Driver.java:481)
at XmlToPdf2.<init>(XmlToPdf2.java:28)
at XmlToPdf2.main(XmlToPdf2.java:42)
java.lang.RuntimeException: java.lang.NullPointerException
at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3170)
at org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(TransformerHandlerImpl.java:433)
at org.apache.xerces.parsers.AbstractSAXParser.endDocument(AbstractSAXParser.java:629)
at org.apache.xerces.impl.XMLNamespaceBinder.endDocument(XMLNamespaceBinder.java:702)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endDocument(XMLDTDValidator.java:974)
at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(XMLDocumentScannerImpl.java:445)
at org.apache.xerces.impl.XMLEntityManager.endEntity(XMLEntityManager.java:1123)
at org.apache.xerces.impl.XMLEntityManager$EntityScanner.load(XMLEntityManager.java:3078)
at org.apache.xerces.impl.XMLEntityManager$EntityScanner.skipSpaces(XMLEntityManager.java:2766)
at org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(XMLDocumentScannerImpl.java:995)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:332)
at org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:510)
at org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:557)
at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:148)
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1096)
at org.apache.xalan.transformer.TrAXFilter.parse(TrAXFilter.java:134)
at org.apache.fop.apps.Driver.render(Driver.java:481)
at XmlToPdf2.<init>(XmlToPdf2.java:28)
at XmlToPdf2.main(XmlToPdf2.java:42)
java.lang.RuntimeException: java.lang.NullPointerException
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1132)
at org.apache.xalan.transformer.TrAXFilter.parse(TrAXFilter.java:134)
at org.apache.fop.apps.Driver.render(Driver.java:481)
at XmlToPdf2.<init>(XmlToPdf2.java:28)
at XmlToPdf2.main(XmlToPdf2.java:42)
java.lang.RuntimeException: java.lang.NullPointerException
at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3170)
at org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(TransformerHandlerImpl.java:433)
at org.apache.xerces.parsers.AbstractSAXParser.endDocument(AbstractSAXParser.java:629)
at org.apache.xerces.impl.XMLNamespaceBinder.endDocument(XMLNamespaceBinder.java:702)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endDocument(XMLDTDValidator.java:974)
at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(XMLDocumentScannerImpl.java:445)
at org.apache.xerces.impl.XMLEntityManager.endEntity(XMLEntityManager.java:1123)
at org.apache.xerces.impl.XMLEntityManager$EntityScanner.load(XMLEntityManager.java:3078)
at org.apache.xerces.impl.XMLEntityManager$EntityScanner.skipSpaces(XMLEntityManager.java:2766)
at org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(XMLDocumentScannerImpl.java:995)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:332)
at org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:510)
at org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:557)
at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:148)
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1096)
at org.apache.xalan.transformer.TrAXFilter.parse(TrAXFilter.java:134)
at org.apache.fop.apps.Driver.render(Driver.java:481)
at XmlToPdf2.<init>(XmlToPdf2.java:28)
at XmlToPdf2.main(XmlToPdf2.java:42)
</pre>
Can anybody help?Hi,
I also facing same problem,did you get the solution.
I am using apache's FOP 0.20.3, xerces-1.2.3 and xalan-2.0.0 and jdk1.3 with weblogic5.1 to convert xml/xsl file to pdf. The code is same as the one given in the org.apache.fop.apps.Driver class.
please give me sample code.
thanks,
[email protected] -
Converting XML to String in OSB
Hi All,
Is there any function (apart from fn-bea:serialize function) for converting XML payload to a String in OSB. Please let me know.
Thanks,
BpeltechieThat's how it's worded by W3C
http://www.w3.org/TR/REC-xml/#syntax
The ampersand character (&) and the left angle bracket (<) must not appear in their literal form, except when used as markup delimiters, or within a comment,
a processing instruction, or a CDATA section. If they are needed elsewhere, they must be escaped using either numeric character references or the
strings " & " and " & lt; " respectively. The right angle bracket (>) may be represented using the string " & gt; ", and must, for compatibility, be
escaped using either " & gt; " or a character reference when it appears in the string " ]]> " in content, when that string is not marking the end
of a CDATA section.Note that it says left angle bracket must not appear in their literal form, but the right angle bracket may be represented using the string " &gt; "
Cheers,
Vlad -
Special charecters handling while Converting XML string to DOM
Hi,
I am using the following approach for converting XML string to DOM, but due to Special characters like "&", I am getting Exceptions:
String xmlString;
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(new InputSource(new StringReader(xmlString)));
Can anyone please help me out on how to handle the Special characters in the above code.If the XML doesn't parse, then the XML must be invalid. Show a sample of such a special character in the XML data. Please use \ tags to post the actual XML content and any other code.
-
Converting XML as table to XML as string
All,
I am successfully able to convert XML table from Internal Table. Now, I would like to convert this XML Table into XML string.
Any help on this will be appreciated.
Regards,
Salil
Moderator message: please search for available information/documentation before asking.
Edited by: Thomas Zloch on Dec 7, 2010 11:57 AMHowdy,
CONCATENATE LINES OF lt_table into l_string SEPARATED BY cl_abap_char_utilities=>cr_lf.
This will create a string of the lines of the internal table with a carriage return after each line.
Cheers
Alex -
Convert XML to SAP internal table
Hi gurus,
My program is suppose to get current exchange rate file from website and upload it in SAP.
by using FM 'HTTP_GET', im getting the data in XML format.My problem is..i have tried to use transformation but failed to
map it against XML data element..and i have tried to use CALL FUNCTION 'SCMS_TEXT_TO_XSTRING' and then CALL FUNCTION 'SMUM_XML_PARSE' but it returns initial value with error ''line 0 col 12-unexpected symbol: '>'' .
Below is an excerpt of my XML file:
..<xml version>
..<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
.. xmlns:o="urn:schemas-microsoft-com:office:office"
.. xmlns:x="urn:schemas- microsoft-com:office:excel"
.. xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
.. <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> <WindowHeight>10875</WindowHeight>........ <WindowWidth>13260</WindowWidth><WindowTopX>480</WindowTopX><WindowTopY>30</Wind
.. <Style ss:ID="Default" ss:Name="Normal">
.. <Alignment ss:Vertical="Bottom"/>
.. <Borders/>
.. <Font/>
.. <Interior/>
.. <NumberFormat/>
.. <Protection/>
.. </Style>
.. <Style ss:ID="BoldColumn">
.. <Font ss:FontName="Microsoft Sans Serif" x:Family="Swiss" ss:Bold="1"/>
.. <Worksheet ss:Name="Page1"><Table ss:StyleID="s21" > <Column ss:Width="130"/> <Column ss:Width="85"/> <Column .. ss:Width="85"/> <Column ss:Width="85"/> <Column ss:Widt
.. Cell><Cell ss:MergeAcross="1" ss:StyleID="BoldColumn"><Data ss:Type="String">Average Buying Rates</Data></Cell><Cell .. ss:MergeDown="1" ss:StyleID="BoldColumn"><Data ss:Type="Stri
.. ss:Type="Number">47.3732</Data></Cell><Cell ss:StyleID="Decimal"><Data ss:Type="Number">47.5374</Data></Cell><Cell .. ss:StyleID="Decimal"><Data ss:Type="Number">48.2323</Data></Ce
.. " ><Data ss:Type="String">HONG KONG</Data></Cell><Cell ss:StyleID="StringLiteralCenter" ><Data .. .. ss:Type="String">HKD</Data></Cell><Cell ss:StyleID="Decimal"><Data ss:Type="Numb
.. ss:Type="Number">22.8131</Data></Cell><Cell ss:StyleID="Decimal"><Data ss:Type="Number">23.2595</Data></Cell>.. .. </Row><Row><Cell ss:StyleID="StringLiteral" ><Data ss:Type="String"
.. ss:StyleID="StringLiteralCenter" ><Data ss:Type="String">IDR</Data></Cell><Cell ss:StyleID="Decimal"><Data .. ss:Type="Number">3.0395</Data></Cell><Cell ss:StyleID="Decimal"><Data
.. ecimal"><Data ss:Type="Number">30.6424</Data></Cell></Row><Row><Cell ss:StyleID="StringLiteral" ><Data .. ss:Type="String">AUSTRALIA</Data></Cell><Cell ss:StyleID="StringLiteralCe
.. ell ss:StyleID="Decimal"><Data ss:Type="Number">0.3392</Data></Cell><Cell ss:StyleID="Decimal"><Data .. ss:Type="Number">0.3409</Data></Cell><Cell ss:StyleID="Decimal"><Data ss:Typ
.. StringLiteral" ><Data ss:Type="String">DENMARK</Data></Cell><Cell ss:StyleID="StringLiteralCenter" ><Data .. ss:Type="String">DKK</Data></Cell><Cell ss:StyleID="Decimal"><Data ss
.. ata ss:Type="Number">4.4550</Data></Cell><Cell ss:StyleID="Decimal"><Data ss:Type="Number">4.6073</Data></Cell>.. </Row><Row></Row><Row></Row><Row><Cell ss:MergeAcross="4" ss:Style
.. s of 23 November 2010</Data></Cell></Row><Row></Row><Row><Cell ss:MergeAcross="4" .. ss:StyleID="BoldColumn_Left" ><Data ss:Type="String">2. Foreign Exchange Rates (THOMSON REUTE
.. ><Data ss:Type="String">ZAR</Data></Cell><Cell ss:StyleID="Decimal"><Data ss:Type="Number">4.2735</Data></Cell>.. <Cell ss:StyleID="Decimal"><Data ss:Type="Number">4.3125</Data></
.. ="Decimal"><Data ss:Type="Number">106.5459</Data></Cell><Cell ss:StyleID="Decimal"><Data .. ss:Type="Number">107.5164</Data></Cell></Row><Row><Cell ss:StyleID="StringLiteral" ><Da
.. a></Cell><Cell ss:StyleID="Decimal"><Data ss:Type="Number">4.6916</Data></Cell></Row><Row><Cell .. ss:StyleID="StringLiteral" ><Data ss:Type="String">BANGLADESH</Data></Cell><Cell
.. r">0.0074</Data></Cell></Row><Row><Cell ss:StyleID="StringLiteral" ><Data ss:Type="String">KENYA</Data></Cell><Cell .. ss:StyleID="StringLiteralCenter" ><Data ss:Type="String">KE
.. ><Cell ss:StyleID="StringLiteral" ><Data ss:Type="String">VIET NAM</Data></Cell><Cell ss:StyleID="StringLiteralCenter" >.. <Data ss:Type="String">VND</Data></Cell><Cell ss:StyleI
.. A</Data></Cell><Cell ss:StyleID="StringLiteralCenter" ><Data ss:Type="String">LKR</Data></Cell><Cell .. .. ss:StyleID="Decimal"><Data ss:Type="Number">0.2686</Data></Cell><Cell ss:St
.. String">OMR</Data></Cell><Cell ss:StyleID="Decimal"><Data ss:Type="Number">77.7094</Data></Cell><Cell
Please help me to translate my XML file into SAP format...i need it fixed urgently..
Edited by: Guest101 on Dec 28, 2010 12:11 PMIt has 2 part one is source code and another is the XML file
create an XML file with the data provided in the last 2.
then place it in a path mention the path in the below source.
1. Complete code for converting XML to internal table in SAP.
*& Report ZTST_PGM02
REPORT ZTST_PGM02.
Load iXML Lib.
type-pools: ixml.
class cl_ixml definition load.
data: G_IXML type ref to if_ixml.
data: STREAMFACTORY type ref to if_ixml_stream_factory.
data: ISTREAM type ref to if_ixml_istream.
data: DOCUMENT type ref to if_ixml_document.
data: PARSER type ref to if_ixml_parser.
data: LV_FILE_URL type rlgrap-filename.
You should provide the parameter for file name
LV_FILE_URL = 'D:\navps\input_xml.xml'.
types: begin of XML_LINE,
DATA(256) type x,
end of XML_LINE.
types: begin of TY_HEADER,
CUST_NAME(20) type c,
CARD_NO(20) type c,
TAX_AMOUNT(10) type c,
TOTAL_AMOUNT(10) type c,
end of TY_HEADER.
types: begin of TY_ITEM,
ITEM_NO(4) type n,
ITEM_ID(20) type c,
ITEM_TITLE(50) type c,
ITEM_QTY(10) type c,
ITEM_UPRICE(10) type c,
end of TY_ITEM.
data: GV_HEADER type TY_HEADER.
data: GT_ITEM type standard table of TY_ITEM with header line.
data: XML_TABLE type table of XML_LINE,
XML_TABLE_SIZE type i.
The next step is creating the main factory for the iXML library:
G_IXML = cl_ixml=>create( ).
Now Create Stream Factory
STREAMFACTORY = G_IXML->create_stream_factory( ).
upload a file from the client's workstation
call function 'WS_UPLOAD'
exporting
filename = LV_FILE_URL
filetype = 'BIN'
importing
filelength = XML_TABLE_SIZE
tables
data_tab = XML_TABLE
exceptions
others = 11.
wrap the table containing the file into a stream
ISTREAM = STREAMFACTORY->create_istream_itable( table = XML_TABLE
size = XML_TABLE_SIZE )
Get the file data as Stream
*istream = streamfactory->create_istream_uri( public_id = lv_file_url
system_id = lv_file_url ).
Create XML Document instance
DOCUMENT = G_IXML->create_document( ).
Create parser Object
PARSER = G_IXML->create_parser( stream_factory = STREAMFACTORY
ISTREAM = istream
DOCUMENT = document ).
Parse an XML document into a DOM tree
*parser->parse( ).
Parsing Error Processing
if PARSER->parse( ) ne 0.
if PARSER->num_errors( ) ne 0.
data: PARSEERROR type ref to if_ixml_parse_error,
STR type STRING,
I type i,
COUNT type I,
INDEX type i.
COUNT = PARSER->num_errors( ).
write: COUNT, ' parse errors have occured:'.
INDEX = 0.
while INDEX < COUNT.
PARSEERROR = PARSER->get_error( INDEX = index ).
I = PARSEERROR->get_line( ).
write: 'line: ', i.
I = PARSEERROR->get_column( ).
write: 'column: ', i.
STR = PARSEERROR->get_reason( ).
write: STR.
INDEX = index + 1.
endwhile.
endif.
endif.
Close the stream since it #s not needed anymore
call method ISTREAM->close( ).
clear ISTREAM.
Now try to make it look good
data : lv_size type sytabix,
lv_ret_code type sysubrc.
data: lo_xml_document type ref to cl_xml_document.
field-symbols: <fs_xml_data> type any table.
lo_xml_document = document.
call method lo_xml_document->get_as_table
importing
table = <fs_xml_data>
size = lv_size
retcode = lv_ret_code
*data: items type ref to if_ixml_node_collection.
*items = document->get_elements_by_tag_name( name = 'Item' ).
*data: iterator type ref to if_ixml_node_iterator,
node type ref to if_ixml_node.
*iterator = document->create_iterator( ).
*node = iterator->get_next( ).
*while not node is initial.
do something with the node
node = iterator->get_next( ).
*endwhile.
DATA : GV_NODE type ref to if_ixml_node.
DATA : GV_NODETEXT type STRING.
data: GV_FIRST_TIME.
GV_FIRST_TIME = 'X'.
GV_NODE = DOCUMENT.
GT_ITEM-item_no = 1.
perform GET_DATA tables GT_ITEM
using GV_NODE
changing GV_HEADER.
Last item is still not added.
append GT_ITEM.
write : GV_HEADER-cust_name,
GV_HEADER-card_no,
GV_HEADER-tax_amount,
GV_HEADER-total_amount.
loop at GT_ITEM.
write /:.
write : GT_ITEM-item_no,
GT_ITEM-item_id,
GT_ITEM-item_title,
GT_ITEM-item_qty,
GT_ITEM-item_uprice.
endloop.
FORM Get_data *
form get_data tables YT_ITEM structure GT_ITEM
using value(x_node) type ref to if_ixml_node
changing Y_HEADER type TY_HEADER.
data: INDENT type i.
data: PTEXT type ref to if_ixml_text.
data: STRING type string.
data: TEMP_STRING(100).
case X_NODE->get_type( ).
when if_ixml_node=>co_node_element.
STRING = X_NODE->get_name( ).
GV_NODETEXT = STRING.
when if_ixml_node=>co_node_text.
PTEXT ?= X_NODE->query_interface( IXML_IID_TEXT ).
if PTEXT->ws_only( ) is initial.
STRING = X_NODE->get_value( ).
case GV_NODETEXT.
when 'Customer'.
clear GV_HEADER.
when 'Name'.
move STRING to GV_HEADER-cust_name.
when 'Cardnum'.
move STRING to GV_HEADER-card_no.
when 'Tax'.
move STRING to GV_HEADER-tax_amount.
when 'Total'.
move STRING to GV_HEADER-total_amount.
Iteam details
when 'ID'.
move STRING to GT_ITEM-item_id.
when 'Title'.
move STRING to TEMP_STRING.
move TEMP_STRING to GT_ITEM-item_title.
when 'Quantity'.
move STRING to GT_ITEM-item_qty.
when 'UnitPrice'.
move STRING to GT_ITEM-item_uprice.
endcase.
endif.
endcase.
if GV_NODETEXT = 'Customer'.
clear GV_HEADER.
elseif GV_NODETEXT = 'Item'.
if GV_FIRST_TIME ne 'X'.
append GT_ITEM.
clear : gt_item.
GT_ITEM-item_no = gt_item-item_no + 1.
endif.
GV_FIRST_TIME = ' '.
endif.
Get the next child
X_NODE = x_node->get_first_child( ).
Recurse
while not X_NODE is initial.
perform GET_DATA tables GT_ITEM
using X_NODE
changing GV_HEADER.
X_NODE = x_node->get_next( ).
endwhile.
endform.
Create an XML file with the following DATA given below and place it in the path mentioned above source code.
2. XML File DATA. You create an XML File in this format to test the same.
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?>
- <Order>
- <Customer>
<Name>Bill Buckram</Name>
<Cardnum>234 234 234 234</Cardnum>
</Customer>
- <Manifest>
- <Item>
<ID>209</ID>
<Title>Duke: A Biography of the Java Evangelist</Title>
<Quantity>1</Quantity>
<UnitPrice>$10.75</UnitPrice>
</Item>
- <Item>
<ID>208</ID>
<Title>100% Pure: Making Cross Platform Deployment a Reality</Title>
<Quantity>1</Quantity>
<UnitPrice>$10.75</UnitPrice>
</Item>
- <Item>
<ID>204</ID>
<Title>Making the Transition from C++ to the Java(tm) Language</Title>
<Quantity>1</Quantity>
<UnitPrice>$10.75</UnitPrice>
</Item>
- <Item>
<ID>202</ID>
<Title>Web Servers for Fun and Profit</Title>
<Quantity>1</Quantity>
<UnitPrice>$10.75</UnitPrice>
</Item>
- <Item>
<ID>210</ID>
<Title>I Think Not: Dukes Likeness to the Federation Insignia</Title>
<Quantity>1</Quantity>
<UnitPrice>$10.75</UnitPrice>
</Item>
</Manifest>
- <Receipt>
<Subtotal>$53.75</Subtotal>
<Tax>$4.43</Tax>
<Total>$58.18</Total>
</Receipt>
</Order> -
Hi All,
Can you please let me know for any sample code in xslt/java mapping for converting XML string into XML. We use SAP Pi 7.0
My XML string starts like this
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:MT_ReceiverFileStructure <namespace>"><Output><?xml version="1.0" encoding="ISO-8859-9"?><?xml-stylesheet type="text/xsl" href="<xsl>"?><Tarih_Date Tarih="11.09.2014" Date="09/11/2014>
Thanks,
PavithraThanks Praveen. It worked.
However, the xml i have is an extract from a exchange rate URL and it has the reference to a xsl in it as below
<?xml version="1.0" encoding="ISO-8859-9"?><?xml-stylesheet type="text/xsl" href="<ABC.xsl>"?>.
So there is an error in sxmb_moni. Is it possible to remove this. -
Problem writing a XSLT to convert XML in desired format from a table having self join
Hello,
I have to write a style sheet to convert XML generated from XSQL into a different format. The query that I have is as follows.
select LEVEL depth,
'H' || hierarchy_id id,
name,
nvl2(parent_id, 'H' || parent_id, 0) parent_id,
CURSOR(select LEVEL depth,
'H' || hierarchy_id hid,
name hname,
nvl2(parent_id, 'H' || parent_id, 0) hparent_id,
decode(system_id, NULL, '0', 'S' || system_id) formatted_system_id,
system_id
from hierarchy
where parent_id = h.hierarchy_id
and system_id is not null
) as systems
from hierarchy h
where system_id is null
start with parent_id is null
connect by prior hierarchy_id = parent_id
The hierarchy table has a self join to itself. The selfjoin is on the hierarchyid and the parentid fields which is evident from the query.
Here the hierarchy table contains the parent system and also the child systems underneath. The problem is that the no. of levels that it can go deep is not fixed. The output of this in sqlplus is as follows.
Depth Hierarchyid, name parentid
1 h1 xxx <null>
2 h2 bbb h1
3 h3 ccc h2
<Cursor for systems>
hid hname hparentid formatted_system_id systemid
h4 ccc h2 s1 1
h5 ccc h2 s2 2
<Back to original data>
Depth Hierarchyid, name parentid
2 h6 ddd h1
2 h7 eee h1
The desired output required from the stylesheet is as follows
<h id=h1 name=xxx>
<h id=h2 name=bbb parentid=h1>
<h id=h3 name=ccc parentid=h2>
<h id=h4 name=fff parentid=h3 systemid=s1>
<h id=h5 name=ggg parentid=h3 systemid=s2>
</h>
</h>
<h id=h6 name=ddd parentid=h1/>
<h id=h7 name=eee parentid=h1/>
</h>
Could some one guide me as to how to get this. I did write a stylesheet which gives me the following output.
<h id=h1 name=xxx>
<h id=h2 name=bbb parentid=h1/>
<h id=h3 name=ccc parentid=h2/>
<h id=h4 name=fff parentid=h3 systemid=s1>
<h id=h5 name=ggg parentid=h3 systemid=s2>
</h>
<h id=h6 name=ddd parentid=h1/>
<h id=h7 name=eee parentid=h1/>
</h>
As you can see I am missing the closing of the tag on the 7th line in the desired format. I have written the following stylesheet.
<!-- Hierarchy.xsl: Transform ROWSET/ROW format to the required Hierarchy format. -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- Template for matching the rowset..... -->
<xsl:template match="HIERARCHY">
<HIERARCHY><xsl:apply-templates/></HIERARCHY>
</xsl:template>
<!-- Template for matching the row .... -->
<xsl:template match="HELEMENT">
<xsl:choose>
<xsl:when test="PARENT_ID=0">
<helement id="{ID}" name="{NAME}" parentid="{PARENT_ID}"/>
</xsl:when>
<xsl:when test="PARENT_ID!='0'">
<helement2 id="{ID}" name="{NAME}" parentid="{PARENT_ID}">
<xsl:for-each select="SYSTEMS/SYSTEMS_ROW">
<helement3 id="{HID}" name="{HNAME}" parentid="{HPARENT_ID}" systemid="{FORMATTED_SYSTEM_ID}">
</helement3>
</xsl:for-each>
</helement2>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Is there any way of achieving this. Any help would be appreciated. I am using XSQL to generate first the basic XML output and then applying stylesheet to achieve the desired output.
Sincerely,
DHello,
I have to write a style sheet to convert XML generated from XSQL into a different format. The query that I have is as follows.
select LEVEL depth,
'H' || hierarchy_id id,
name,
nvl2(parent_id, 'H' || parent_id, 0) parent_id,
CURSOR(select LEVEL depth,
'H' || hierarchy_id hid,
name hname,
nvl2(parent_id, 'H' || parent_id, 0) hparent_id,
decode(system_id, NULL, '0', 'S' || system_id) formatted_system_id,
system_id
from hierarchy
where parent_id = h.hierarchy_id
and system_id is not null
) as systems
from hierarchy h
where system_id is null
start with parent_id is null
connect by prior hierarchy_id = parent_id
The hierarchy table has a self join to itself. The selfjoin is on the hierarchyid and the parentid fields which is evident from the query.
Here the hierarchy table contains the parent system and also the child systems underneath. The problem is that the no. of levels that it can go deep is not fixed. The output of this in sqlplus is as follows.
Depth Hierarchyid, name parentid
1 h1 xxx <null>
2 h2 bbb h1
3 h3 ccc h2
<Cursor for systems>
hid hname hparentid formatted_system_id systemid
h4 ccc h2 s1 1
h5 ccc h2 s2 2
<Back to original data>
Depth Hierarchyid, name parentid
2 h6 ddd h1
2 h7 eee h1
The desired output required from the stylesheet is as follows
<h id=h1 name=xxx>
<h id=h2 name=bbb parentid=h1>
<h id=h3 name=ccc parentid=h2>
<h id=h4 name=fff parentid=h3 systemid=s1>
<h id=h5 name=ggg parentid=h3 systemid=s2>
</h>
</h>
<h id=h6 name=ddd parentid=h1/>
<h id=h7 name=eee parentid=h1/>
</h>
Could some one guide me as to how to get this. I did write a stylesheet which gives me the following output.
<h id=h1 name=xxx>
<h id=h2 name=bbb parentid=h1/>
<h id=h3 name=ccc parentid=h2/>
<h id=h4 name=fff parentid=h3 systemid=s1>
<h id=h5 name=ggg parentid=h3 systemid=s2>
</h>
<h id=h6 name=ddd parentid=h1/>
<h id=h7 name=eee parentid=h1/>
</h>
As you can see I am missing the closing of the tag on the 7th line in the desired format. I have written the following stylesheet.
<!-- Hierarchy.xsl: Transform ROWSET/ROW format to the required Hierarchy format. -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- Template for matching the rowset..... -->
<xsl:template match="HIERARCHY">
<HIERARCHY><xsl:apply-templates/></HIERARCHY>
</xsl:template>
<!-- Template for matching the row .... -->
<xsl:template match="HELEMENT">
<xsl:choose>
<xsl:when test="PARENT_ID=0">
<helement id="{ID}" name="{NAME}" parentid="{PARENT_ID}"/>
</xsl:when>
<xsl:when test="PARENT_ID!='0'">
<helement2 id="{ID}" name="{NAME}" parentid="{PARENT_ID}">
<xsl:for-each select="SYSTEMS/SYSTEMS_ROW">
<helement3 id="{HID}" name="{HNAME}" parentid="{HPARENT_ID}" systemid="{FORMATTED_SYSTEM_ID}">
</helement3>
</xsl:for-each>
</helement2>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Is there any way of achieving this. Any help would be appreciated. I am using XSQL to generate first the basic XML output and then applying stylesheet to achieve the desired output.
Sincerely,
D
Maybe you are looking for
-
I purchased the blu-ray of The Hunger Games and it came with a code to redeem for a digital copy. I redeemed the code in iTunes and the movie downloaded fine, but the "EXTRAS" have been downloading for 2 weeks! Everytime I launch iTunes it starts the
-
Hi everybody! (Sorry with my English) I have installed Archlinux x86_64 on my laptop HP Probook 4515s. After installation is completed, restart the computer has been suspended. I also tried with OpenSUSE and Debian, I found the problem in Ethernet ca
-
hi frnds, while doing bpm scenarios splitting(1:2) and merging(2:1) messages, a) in splitting scenario integration process container, we use 3 abstract interfaces and 2 multiline receivers (using fork here) b) in merging scenario integration process
-
I have a dynamic LOV as the only item in a portlet. The page is a 2 column layout with 2 tabs. When I click on the second tab I get 'There is currently no HTML content' message where the LOV should appear. Why?
-
Q: No daylight saving in waveform chart
Hello, I'm lost: I have a large logfile (couple of years) and i wan't to display this with labview. The times i use are labview timestamps (seconds since 1 januari 1904 0:00 utc). Problem is when i plot them in a chart it displays them in my local ti