Two prologs in XML document
Good evening!
I am trying to create a SOAP message using DocumentBuilderFactory, but I get an exception if I try to declare mitiple prologs. Is there anyway to declare mutiple prologs?
An XML docuemnt is actually being sent to the WS, so the SOAP message has a prolog and then the XML document that is being passed has one also.
Thanks,
Doug
this,
That shouldn't be difficult to do at all. Start with a text box on page one (make sure it's defined in the Wrap inspector as Floating, and not Inline). Click on the little blue "ear" on the right side of the text box to create a linking text box. Drag that second text box to page three. Position the two text boxes where you want them on their pages, then resize them to suit your needs. Now the overflow text from page one will wrap to page three. Do the same thing for pages two and four.
Does this answer your question?
-Dennis
Similar Messages
-
Possible to compare Word 2007 XML documents?
I am trying to compare two word 2007 XML documents (.doc) using XMLUnit but I keep getting an assertion fail on the CDATA fields:
org.custommonkey.xmlunit.Diff [different] Expected text value '28/05/2009 22.50' but was '27/05/2009 15.02'This are the corresponding parts of the word xml files that differ:
<w:t><![CDATA[28/05/2009 22.50]]></w:t>
<w:t><![CDATA[27/05/2009 15.02]]></w:t>
I have tried to enable:
XMLUnit.setIgnoreDiffBetweenTextAndCDATA(true);But it still treats the sections as differences. When I compare the two files I have tried:
// test 1
InputSource xml1 = new InputSource("c:\\test\\actual.xml");
InputSource xml2 = new InputSource("c:\\test\\expected.xml");
Diff myDiff = new Diff(xml1, xml2);
myDiff.overrideElementQualifier(new RecursiveElementNameAndTextQualifier() );
assertXMLEqual("Not similar", myDiff, true);
// test 2
assertXMLEqual(expectedOutPutFileAsString, actualOutPutFileAsString);But the assertion fails in both cases.
Is it even possible to compare two word 2007 files like this?Telling someone that they can convert a Powerpoint to PDF and send that to their phone is NOT a "third party hack."
Which BTW is what you want to do because it will preserve all the pagination, orientation, resolution, etc, all in one nice tidy file. And, (if you email it to your phone through an IMAP enabled mail server like GMail) you can then forward the PDF file directly from the iPhone to someone else. -
How to compare the contents of two XML documents
Hi all,
I was trying to compare the contents of two xml documents, they are both validate for the same XML Schema. i was using the xmlunit to do this. but some how it doesn't work like what i have expected. for example:
1.xml : <test><item>2</item><item>1</item></test>
2.xml: <test><item>3</item><item>2</item><item>1</item></test>
the result from XMLUnit is this two xmls are different, but it compares <item>2</item> with <item>3</item>, which i cannot find out where the real diiffs are.
does anybody know how i can do this correct?
best regards,
tinaI faced a similar problem in one of my projects and hence wrote my own comparator. Most comparators like ExamXML etc show XML as different if the nodes under a parent node occur in different seqeunce or a set of repeated nodes occur in different sequence. The comparator that I wrote gives you the flexibility to configure how to identify a node from a set of repeated nodes and is able to compare them successfully if they occur in any order. You can view the sample output at http://geocities.com/dheerendra_itbhu/TipsFromDheeru.html
and contact me in case you need the source code. -
How to split XML document into two
I want to create new docuemnt by taking part of the existent XML document under the node document_text
vNodeList := xmldom.getElementsByTagName(vdoc, 'document_text');
vNode := xmldom.item(vNodeList, 0); -- The xmldom.getNodeName(vNode) of this node is exactly what i am
-- looking for
vdoc:= xmldom.makeDocument( vNode);
insert into cltab values (empty_clob()) returning cl into cl;
xmldom.writeToClob(vdoc_txt, cl);
But after that i am still getting the whole document tree, - copy of the whole document.
What am i doing wrong? What functions should i use for this kind of task? xmldom.clonenode?
Could you recommend any good description of the xmldom package?
Thanks,
RomanIf you are using an FI entry F-43 to generate invoice this can be done by giving the same invoice ref. in the Inv. Ref. field for two vendors. This is manual
Document Split will split the document between two profit center and not between vendors. -
An invalid XML character (Unicode: 0x0) was found in the prolog of the docu
Hi folks,
I'm using the SAX parser to parse a small xml file. If I use that file in IE, there its parsing correctly and displaying the xml in the tree structure.
But in my Java code its throwing
org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x0) was found in the prolog of the document.
The xml parsing code of my program is
XMLReader parser = XMLReaderFactory.createXMLReader(
"org.apache.xerces.parsers.SAXParser");
HelpPartHandler hp = new HelpPartHandler();
parser.setContentHandler(hp);
RandomAccessFile raf = new RandomAccessFile("sample.xml","r");
byte Contents[] = new byte[(int)raf.length()];
StringReader sr = new StringReader(new String(Contents));
InputSource is = new InputSource(sr);
parser.parse(is);
The xml file is
<?xml version="1.0"?>
<ROOT>
<NODE> Java </NODE>
</ROOT>
Please let me know the mistakes what I have done. Looking for the reply.
Thanks in Advance
PrabuThe message seems clear to me. Your document contains a null character, which is not valid in an XML document. Take it out of the document, and change whatever produced the document to not put it there. (I hope you don't consider Microsoft software to be standards-compliant.)
-
Merging two XML Document Objects
I'm trying to merge two seperate XML Document Objects into one Object.
Any suggestions would be very much appreciated.
This is what the Objects look like when returned.
FIRST:
<?xml version = '1.0'?>
<app>
<name>Home</name>
<active>true</active>
<order-as-sibling>1</order-as-sibling>
</app>
SECOND:
<app>
<name>Developers</name>
<active>true</active>
<order-as-sibling>6</order-as-sibling>
</app>That would work nicely if the XML documents had names, but they are coming back as a list in an XML object. I have about 8 separate XML Objects I'd like to merge into one.
Thanks -
Possible to combine two xml documents into a single query?
In ASP, PHP, etc. if I wanted to combine two tables and
filter by one =
item, I would create a recordset combining the two on one
common element =
and have one recordset. Is that possible with xml documents
and Spry =
datasets?
I have xml information sent to me 4 times a day from a
weather service. =
This happens automatically, but the two xml documents
(current.xml and =
forecast.xml) are set in stone by the service. However, if in
my Spry =
dataset, I could combine them so I could list the 15 cities
in a master =
region and have tabs for the current conditions and forecast
which would =
each access a separate xml document but needs to do that from
the city =
link on the left, that would work great.
Can I do this as I would be able to if I had a database with
different =
tables?
Thanks!
NancyHi Kin:
They are really static xml files that are placed in a folder
directly by =
the weather service. The files in question are current.xml
and =
forecast.xml.
And there is not one per city .. but just one of each. the
location =
node in current.xml and the citycode node in forecast.xml
contain the =
same information.
If I were doing this in a recordset with a database, I would
write =
something like SELECT whatever from current, forecast WHERE =
current.location =3D forecast.citycode AND current.location
=3D variable =
(which would be what is clicked on).
This sets up a master/detail arrangement for the first one
that works =
fine. Click on the city code (which I have to write something
to say If =
location =3D FAT, document.write "Fresno" and so on) and the
rest of the =
current information displays fine on the right side of the
page. Now I =
have to marry that to the forecast.xml file so that when
citycode =3D =
FAT, the five day information for Fresno shows up .. and so
on. I was =
planning to use Spry tabs or whatever to show the data.
<!--
var dsCurrent =3D new Spry.Data.XMLDataSet("current.xml", =
"weather/current");
//-->
</script>
</head>
<body>=20
<div class=3D"MasterDetail">
<div spry:region=3D"dsCurrent"
class=3D"MasterContainer">
<div class=3D"MasterColumn" spry:repeat=3D"dsCurrent" =
spry:setrow=3D"dsCurrent" spry:hover=3D"MasterColumnHover" =
spry:select=3D"MasterColumnSelected">{location}</div>
</div>
<div spry:detailregion=3D"dsCurrent"
class=3D"DetailContainer">
<div class=3D"DetailColumn">{phrase}</div>
<div class=3D"DetailColumn">{temp}</div>
<div class=3D"DetailColumn">{temp/@units}</div>
<div class=3D"DetailColumn">{aptemp}</div>
<div class=3D"DetailColumn">{aptemp/@unit}</div>
<div class=3D"DetailColumn">{wndchl}</div>
<div class=3D"DetailColumn">{wndchl/@unit}</div>
<div class=3D"DetailColumn">{rhumid}</div>
<div class=3D"DetailColumn">{rhumid/@unit}</div>
<div class=3D"DetailColumn">{wind_dir}</div>
<div class=3D"DetailColumn">{windspeed}</div>
<div
class=3D"DetailColumn">{windspeed/@unit}</div>
<div class=3D"DetailColumn">{pres}</div>
<div class=3D"DetailColumn">{pres/@unit}</div>
<div class=3D"DetailColumn">{vis}</div>
<div class=3D"DetailColumn">{vis/@unit}</div>
<div class=3D"DetailColumn">{icon}</div>
</div>
Arnout gave me some suggestions .. but so far, I haven't
gotten either =
of them to work. Also I am trying to get some ideas from spry
Samples =
from the Spry home page/samples area, but again .. not yet.
Thanks,
Nancy
"kinblas" <[email protected]> wrote in
message =
news:[email protected]...
>I don't think you need to combine them just so they can
render in a =
tabbed=20
> widget. We're still missing a couple of key pieces of
information. =
What does=20
> the data that is used in the master region look like?
Are what you =
refer to as=20
> current.xml and forecast.xml really static files? Or are
they =
dynamically=20
> generated by a server side script (php/cf/etc)? There is
one current =
and=20
> forecast xml per city right?
>=20
> I ask these questions because you may be able to simply
set up a =
master detail=20
> relationship between 3 data sets and just use those
within a region(s) =
that=20
> build up the tab widget. Assuming you were getting the
list of cities =
from a=20
> 3rd source, you could set up something like this:
>=20
>=20
> var dsCities =3D new Spry.Data.XMLDataSet("cities.xml",
=
"/cities/city");
> var dsCurrent =3D new=20
>
Spry.Data.XMLDataSet("current.php?location=3D{dsCities::name}",=20
> "/weather/current");
> var dsForecast =3D new=20
>
Spry.Data.XMLDataSet("forecast.php?citycode=3D{dsCities::name}",=20
> "/weather/forecast/day");
>=20
>=20
> ...
>=20
>=20
> <div id=3D"TabbedPanels1" class=3D"TabbedPanels">
> <ul class=3D"TabbedPanelsTabGroup">
>
Current</li>
>
Forecast</li>
>
> <div class=3D"TabbedPanelsContentGroup">
> <div class=3D"TabbedPanelsContent"
spry:region=3D"dsCurrent">
> {temp}{temp/@unit}
> </div>
> <div class=3D"TabbedPanelsContent"
spry:region=3D"dsForecast">
>
> <li spry:repeat=3D"dsForecast">{name}<br
/>High: =
{high}{high/@unit}<br=20
> />Low: {low}{low/@unit}</li>
>
> </div>
> </div>
> </div>
>=20
>=20
>=20
> --=3D=3D Kin =3D=3D--
> -
Build the delta from two xml documents
Hi,
i look for a solution to solve the following problem:
i want to build a xml-based interface to pass my data to a client(Web etc.) and i dont know in which way the client manipulates the data and what in the xml-document was changed, inserted or deleted.
What i have is the original-document and the changed-document (both based on the same DTD). How can i determine the delta from the two documents, cause i must know what actions to be taken (for example put <?bc4j remove?> or an appropriate tag for the XDK in the xml)
any suggestion ???
TIA
OliverThe Oracle XDK for Java comes with a utility called XMLDiffer that, given XML Documents A and B, produces an XSLT stylesheet S that transforms A to B.
Might be of use to you. That's the only inhouse XML diffing technology that I'm aware of. We use it internally in JDeveloper for merging machine-generate web.xml file edits with the user's hand-written web.xml file edits. -
Difference between two xml documents
Hi,
I have two xml documents docA and docB that loos like this,
<root>
<a>
<b>...</b>
<c>...</c>
<d>...</d>
</a>
<a>
</a>
</root>I want to compare them and get a new xml document that consists of every <a> thats only in docB (I know that the only two cases is that a given <a> is either in both or only in docB) is there any library that can help me with this? I've looked at xmlunit but I could only get it to either just return true/false or give a complete list of differences.
/AndreasYou have not really specified precisely what you want to compare on. XQuery 1.0 and XPath 2.0 have a function deep-equal that might be able to do what you want so an XQuery like
<root>{
doc('docB.xml')/root/a[not(some $a in doc('docA.xml')/root/a satisfies deep-equal(., $a))]
</root>could give you the result you want, depending on whether the [specification of deep-equal|http://www.w3.org/TR/xpath-functions/#func-deep-equal] matches your expectation.
As the SUN Java JRE has no XQuery support you need a third party library such as [Saxon 9|http://saxon.sourceforge.net/] . -
How to save sections of a single XML Document to multiple tables ?
Firstly, I apologise for the long e-mail but I feel it's necessary in order to clarify my problem/question.
The XML document representation below stores information about a particular database. From the information in the XML document you can tell that there is a single database called "tst" which contains a single table called "tst_table". This table in turn has two columns called "CompanyName" & "Country".
I want to use Oracle's XML SQL Utility to store this information into three seperate database tables. Specifically, I want to store the information pertaining to the database (i.e. name etc.) in one table, the information pertaining to the table (name, no. of columns etc.) in another and the information pertaining to the columns (name, type etc.) in yet another table.
I have seen samples where an entire XML Document is saved to a database table but I cannot find any examples where different sections of a single XML Document are saved into different database tables using the XML SQL Utility.
Can you please tell me the best approach to take in order to accomplish this . Does it involve creating an XMLDocument and then extracting the relevant sections as XMLDocumentFragment's, retrieving the String representations of these XMLDocumentFragment's and passing these strings to the OracleXMLSave.insertXml() method.
Is this the best approach to take or are there any other, perhaps more efficient or elegant, ways of doing this ?
Thanks in advance for your help
- Garry
<DATABASE id="1" name="tst">
<TABLES>
<TABLE name="tst_table">
<NAME>Customers</NAME>
<COLUMNS>
<COLUMN num="1"> <COLID>2</COLID>
<COLNAME>CompanyName</COLNAME>
<COLTYPE>Text</COLTYPE>
</COLUMN>
<COLUMN num="2">
<COLID>3</COLID>
<COLNAME>Country</COLNAME>
<COLTYPE>Text</COLTYPE>
</COLUMN>
</COLUMNS>
</TABLE>
</TABLES>
</DATABASE>
nullSee this thread;
{thread:id=2180799}
Jeff -
How to search for a text node with a particular value in an xml document with labview
supposing i have the following xml document:
<head>
<book>
<bookname>zio</bookname>
<author>dan</author>
</book>
<book>
<bookname>the spear warrior</bookname>
<author>britney</author>
</book>
<book>
<bookname>the beard</bookname>
<author>derrick</author>
</book>
</head>
i want to search for the author of the book "the beard" using for example the V.I Get first match of labview to access the the node with value "the beard" and then use Get next sibling V.I and Get node text content to get get the author of this book..so my question is how do i write the xpath expression for Get first match so as to access the node with bookname "the beard" instantyly? am trying to minimise the use of loops because they increase the time duration,..thank you (NB:i dont want to use Get all Matched V.I because it obliges me to use a loop in order to access the name derrick and this increases the time duration for my v.i)
Solved!
Go to Solution.Since it's all text, why not use a real quick Match Pattern (or Regular Expression, but you don't need that much power here), see attached.
Cameron
To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.
To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
LabVIEW Unit 1 - Getting Started
Learn to Use LabVIEW with MyDAQ
Attachments:
Two-stage match demo.vi 8 KB -
Xml document validation using Schema
I want to validate XML Document using XML Schema...
does any body have an idea how to do it.
Every time i m running my java file by using different XML FILE AND XSD FILE in command line i m getting same error.
error is:
Exception in thread "main" org.xml.sax.SAXException: Error: URI=null Line=2: s4s-elt-schema-ns: The namespace of element 'catalog' must be from the schema name space.
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1115)
at SAXLocalNameCount.main(SAXLocalNameCount.java:117)
Below is my java code with xml file and schema file.
plz get back to me as soon as possible it is urgent.
thanx
java File
import javax.xml.parsers.*;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import java.util.*;
import java.io.*;
public class SAXLocalNameCount extends DefaultHandler {
/** Constants used for JAXP 1.2 */
static final String JAXP_SCHEMA_LANGUAGE =
"http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String W3C_XML_SCHEMA =
"http://www.w3.org/2001/XMLSchema";
static final String JAXP_SCHEMA_SOURCE =
"http://java.sun.com/xml/jaxp/properties/schemaSource";
/** A Hashtable with tag names as keys and Integers as values */
private Hashtable tags;
// Parser calls this once at the beginning of a document
public void startDocument() throws SAXException {
tags = new Hashtable();
// Parser calls this for each element in a document
public void startElement(String namespaceURI, String localName,
String qName, Attributes atts)
throws SAXException
String key = localName;
Object value = tags.get(key);
if (value == null) {
// Add a new entry
tags.put(key, new Integer(1));
} else {
// Get the current count and increment it
int count = ((Integer)value).intValue();
count++;
tags.put(key, new Integer(count));
System.out.println("TOTAL NUMBER OF TAG IN FILE = "+count);
// Parser calls this once after parsing a document
public void endDocument() throws SAXException {
Enumeration e = tags.keys();
while (e.hasMoreElements()) {
String tag = (String)e.nextElement();
int count = ((Integer)tags.get(tag)).intValue();
System.out.println("Local Name \"" + tag + "\" occurs " + count
+ " times");
static public void main(String[] args) throws Exception {
String filename = null;
String schemaSource = null;
// Parse arguments
schemaSource = args[0];
filename = args[1];
// Create a JAXP SAXParserFactory and configure it
SAXParserFactory spf = SAXParserFactory.newInstance();
// Set namespaceAware to true to get a parser that corresponds to
// the default SAX2 namespace feature setting. This is necessary
// because the default value from JAXP 1.0 was defined to be false.
//spf.setNamespaceAware(true);
// Validation part 1: set whether validation is on
spf.setValidating(true);
// Create a JAXP SAXParser
SAXParser saxParser = spf.newSAXParser();
System.out.println(" saxparser "+saxParser);
// Validation part 2a: set the schema language if necessary
if (true) {
try {
saxParser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
System.out.println(" saxparser ");
} catch (SAXNotRecognizedException x) {
// This can happen if the parser does not support JAXP 1.2
System.err.println(
"Error: JAXP SAXParser property not recognized: "
+ JAXP_SCHEMA_LANGUAGE);
System.err.println(
"Check to see if parser conforms to JAXP 1.2 spec.");
System.exit(1);
// Validation part 2b: Set the schema source, if any. See the JAXP
// 1.2 maintenance update specification for more complex usages of
// this feature.
if (schemaSource != null) {
saxParser.setProperty(JAXP_SCHEMA_SOURCE, new File(schemaSource));
System.out.println(" saxparser 123");
// Get the encapsulated SAX XMLReader
XMLReader xmlReader = saxParser.getXMLReader();
System.out.println(" XML READER "+xmlReader);
// Set the ContentHandler of the XMLReader
xmlReader.setContentHandler(new SAXLocalNameCount());
System.out.println(" XML READER 345 ");
// Set an ErrorHandler before parsing
xmlReader.setErrorHandler(new MyErrorHandler(System.err));
System.out.println(" XML READER 67878 ");
// Tell the XMLReader to parse the XML document
xmlReader.parse(filename);
System.out.println(" XML READER ");
// Error handler to report errors and warnings
private static class MyErrorHandler implements ErrorHandler {
/** Error handler output goes here */
private PrintStream out;
MyErrorHandler(PrintStream out) {
this.out = out;
* Returns a string describing parse exception details
private String getParseExceptionInfo(SAXParseException spe) {
String systemId = spe.getSystemId();
if (systemId == null) {
systemId = "null";
String info = "URI=" + systemId +
" Line=" + spe.getLineNumber() +
": " + spe.getMessage();
return info;
// The following methods are standard SAX ErrorHandler methods.
// See SAX documentation for more info.
public void warning(SAXParseException spe) throws SAXException {
out.println("Warning: " + getParseExceptionInfo(spe));
public void error(SAXParseException spe) throws SAXException {
String message = "Error: " + getParseExceptionInfo(spe);
throw new SAXException(message);
public void fatalError(SAXParseException spe) throws SAXException {
String message = "Fatal Error: " + getParseExceptionInfo(spe);
throw new SAXException(message);
xml file(books.xml)
<?xml version="1.0"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications
with XML.</description>
</book>
<book id="bk102">
<author>Ralls, Kim</author>
<title>Midnight Rain</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-12-16</publish_date>
<description>A former architect battles corporate zombies,
an evil sorceress, and her own childhood to become queen
of the world.</description>
</book>
<book id="bk103">
<author>Corets, Eva</author>
<title>Maeve Ascendant</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-11-17</publish_date>
<description>After the collapse of a nanotechnology
society in England, the young survivors lay the
foundation for a new society.</description>
</book>
<book id="bk104">
<author>Corets, Eva</author>
<title>Oberon's Legacy</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2001-03-10</publish_date>
<description>In post-apocalypse England, the mysterious
agent known only as Oberon helps to create a new life
for the inhabitants of London. Sequel to Maeve
Ascendant.</description>
</book>
<book id="bk105">
<author>Corets, Eva</author>
<title>The Sundered Grail</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2001-09-10</publish_date>
<description>The two daughters of Maeve, half-sisters,
battle one another for control of England. Sequel to
Oberon's Legacy.</description>
</book>
<book id="bk106">
<author>Randall, Cynthia</author>
<title>Lover Birds</title>
<genre>Romance</genre>
<price>4.95</price>
<publish_date>2000-09-02</publish_date>
<description>When Carla meets Paul at an ornithology
conference, tempers fly as feathers get ruffled.</description>
</book>
<book id="bk107">
<author>Thurman, Paula</author>
<title>Splish Splash</title>
<genre>Romance</genre>
<price>4.95</price>
<publish_date>2000-11-02</publish_date>
<description>A deep sea diver finds true love twenty
thousand leagues beneath the sea.</description>
</book>
<book id="bk108">
<author>Knorr, Stefan</author>
<title>Creepy Crawlies</title>
<genre>Horror</genre>
<price>4.95</price>
<publish_date>2000-12-06</publish_date>
<description>An anthology of horror stories about roaches,
centipedes, scorpions and other insects.</description>
</book>
<book id="bk109">
<author>Kress, Peter</author>
<title>Paradox Lost</title>
<genre>Science Fiction</genre>
<price>6.95</price>
<publish_date>2000-11-02</publish_date>
<description>After an inadvertant trip through a Heisenberg
Uncertainty Device, James Salway discovers the problems
of being quantum.</description>
</book>
<book id="bk110">
<author>O'Brien, Tim</author>
<title>Microsoft .NET: The Programming Bible</title>
<genre>Computer</genre>
<price>36.95</price>
<publish_date>2000-12-09</publish_date>
<description>Microsoft's .NET initiative is explored in
detail in this deep programmer's reference.</description>
</book>
<book id="bk111">
<author>O'Brien, Tim</author>
<title>MSXML3: A Comprehensive Guide</title>
<genre>Computer</genre>
<price>36.95</price>
<publish_date>2000-12-01</publish_date>
<description>The Microsoft MSXML3 parser is covered in
detail, with attention to XML DOM interfaces, XSLT processing,
SAX and more.</description>
</book>
<book id="bk112">
<author>Galos, Mike</author>
<title>Visual Studio 7: A Comprehensive Guide</title>
<genre>Computer</genre>
<price>49.95</price>
<publish_date>2001-04-16</publish_date>
<description>Microsoft Visual Studio 7 is explored in depth,
looking at how Visual Basic, Visual C++, C#, and ASP+ are
integrated into a comprehensive development
environment.</description>
</book>
</catalog>
(books.xsd)
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="catalog">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="book" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="author" type="xsd:string"/>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="genre" type="xsd:string"/>
<xsd:element name="price" type="xsd:float"/>
<xsd:element name="publish_date" type="xsd:date"/>
<xsd:element name="description" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>Add xmlns:xsi attribute to the root element <catalog>.
<catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation='books.xsd'> -
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}
For the last 5 years (and in IPCC3.x/4.x,UCCX/5.x/7.x) I've used the same basic subflow to read a XML document that contains holiday dates where the queue should be closed. I've re-used this script on 20+ client installs and it's always worked. The structure of the script allows you to pass the path and filename of the XML document as parameters to the subflow. (The document is in the repository)
I loaded this script in UCCX 8.0.2 recently and it crashed with a Java.IO error. It looked like it was trying to read the file system directly and not the repository. (In the Linux appliance model this kind of makes sense but why is the step trying to read the file system directly?)
So I open a TAC case (SR# 615243125) and TAC tells me that the method of using the Create File Document step is not supported anymore and that I should specify the filename directly in the Create XML Document step
The problem that I see (aside from having to edit all my scripts that use XML files) is that the Create XML Document step is looking for the input to be a type DOCUMENT and not a type STRING. This seems to imply that I have to hardcode the document in each script that I deploy for a customer. When it was a string it was easy to construct the full file path from parameters and pass to the subflow.
Questions to the group
#1 Am I missing something here?
#2 Do you assume that you'll be able to load a script that worked fine in UCCX 7 into UCCX 8 and that it should completely function when you're doing everything according to the step reference documentation.
#3 Cisco didn’t document this in any way that I can find.
#4 How can you use the Create XML Document step in a fashion that would let you construct the path of the file and the filename previously in the script so you could pass it to a subflow ? It would seem this functionality has been killed in UCCX 8
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}
(Background)
Create File Document Step
The input filename is a STRING, could be an explicit path and filename in the repository or a variable that represents that path and string
The output of this step is a DOCUMENT to be used in the Create XML Document step
The string FILE_FullPathHolidayFiles references en_us\folderName\documentName.xml
The document was properly uploaded into the repository only, NOT trying to directly read c:\foo\blah…
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}
The create XML document input can only be a type DOCUMENT#1 Am I missing something here?
You are mixing two different issues together here.
The Create File Document step is indeed not needed or supported for creating an XML document. That is why there is a unique step; to trigger XML parsing within the MIVR subsystem.
Accessing the file system is restricted to a single folder within the VOS model (i.e. 8.0+). This folder is not backed up, replicated, or cleaned up automatically. It was intended to give developers some FS access as a temporary swap location only.
#2 Do you assume that you'll be able to load a script that
worked fine in UCCX 7 into UCCX 8 and that it should completely
function when you're doing everything according to the step reference
documentation.
Assume nothing; read the documentation and attend one of the dozens of partner training sessions that CCBU put on advising of the upcoming changes.
#3 Cisco didn’t document this in any way that I can find.
You're right, I guess, on the Create File vs. XML Document step. AFAIK Cisco never wrote a notice into the Step Reference Guide explicitly stating that you cannot use the Create File Document although the documentation seemed pretty clear to me without it. File system restrictions are documented in the 8.0 release notes.
Scripting and Development Series: Volume 2, Editor Step ReferenceUse the Create XML Document step to create a logical document that maps a document to another document variable (where the document has already been pre-parsed as an XML document and is ready to be accessed by the Get XML Document Data step).Use this step before the Get XML Document Data step to obtain data from a document formatted using the Extensible Markup Language (XML).
#4 How can you use the Create XML Document step in a fashion that would
let you construct the path of the file and the filename previously in
the script so you could pass it to a subflow ? It would seem this functionality has been killed in UCCX 8
No it hasn't; just concatinate a string to build the Source Document parameter the step needs. Example: "DOC[" + myFilePath + "]" -
How to parse multiple xml documents from single buffer
Hello,
I am trying to use jaxb 2.0 to parse a buffer which contains multiple xml documents. However, it seems that it is meant to only parse a single document at a time and throws an exception when it gets to the 2nd document.
Is there a way I can tell jaxb to only parse the first complete document and not fetch the next one out of the buffer? Or what is the most efficient way to separate the buffer into two documents without parsing it manually. If I have to search the buffer for the next document root and then split the buffer, it seems like that defeats the purpose of using jaxb as the parser.
I am using the Unmarshaller.unmarshall method and the exception I am getting is:
org.xml.sax.SAXParseException: Illegal character at end of document, <.]
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:315)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:476)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:198)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:167)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:184)
Thank you for your helpIt's just like any other XML parser, it's only designed to parse one XML document. If you have something that concatenates two XML documents together (that's what your "buffer" sounds like), then stop doing that.
-
Create repeating elements in xml document
Good day,
I have a problem with a project I am busy with. I am creating an XML document from a predefined schema. I am able to this with no problem for one level using this method:
XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
XmlSerializer serializer = new XmlSerializer(typeof(UKFATCASubmissionFIReport));
TextWriter writer = new StreamWriter(destinationPath);
UKFATCASubmissionFIReport fatcaSub = new UKFATCASubmissionFIReport();
fatcaSub.SchemaVersion = schemaVersion;
//Initialize classes and objects
#region classes and objects
AccountDataType accountData = new AccountDataType();
AccountHolderCodeType accountHolderType = new AccountHolderCodeType();
MessageDataType messageData = new MessageDataType();
MonetaryType moneyType = new MonetaryType();
SubmissionType submissionData = new SubmissionType();
FIReturnActionType fireturnActionData = new FIReturnActionType();
AccountActionType accountActionData = new AccountActionType();
TINCodeType tinCode = new TINCodeType();
HolderTaxInfoType holderInfo = new HolderTaxInfoType();
//PaymentDataType paymentData = paymentDetails();
#endregion
//Monetary type
moneyType.Value = moneyTypeValue;
moneyType.currCode = currCode_Type.GBP;
//Create message data
messageData.FATCAUserId = FatcaUserID;
messageData.XMLTimeStamp = timeStamp;
messageData.MessageCategory = MessageType.NewSubmission;
fatcaSub.MessageData = messageData;
//Create submission data object
submissionData.ReportingPeriod = reportingPeriod;
submissionData.Item = messageRef;
fatcaSub.Item = submissionData;
//FI Return Action
fireturnActionData.Action = ActionType.New;
fireturnActionData.FIReturnRef = returnRef;
//FIReturnActionType[] fireturnItems = new FIReturnActionType[] { fireturnActionData };
//TIN Code Type
tinCode.TINCountryCode = countryCode;
tinCode.Value = tinCodeValue;
tinCode.TINCountryCodeSpecified = itemSpecified;
//TIN Information
holderInfo.ReportableJurisdiction = countryCode;
holderInfo.TIN = holderTIN;
holderInfo.TINCode = tinCode;
//ContactPersonInformation contactInfo = ContactInformation(holderInfo);
//Contact address
ContactAddressType contactAddress = new ContactAddressType();
contactAddress.StreetName = streetName;
contactAddress.City = contactCity;
contactAddress.CountryCode = holderInfo.ReportableJurisdiction;
//Person Details
ContactPersonInformation contactInfo = new ContactPersonInformation();
contactInfo.FirstName = firstName;
contactInfo.LastName = lastName;
contactInfo.Address = contactAddress;
contactInfo.HolderTaxInfo = holderInfo;
contactInfo.BirthDateSpecified = itemSpecified;
contactInfo.BirthDate = dateOfBirth;
PaymentMonetaryType paymentMonetary = new PaymentMonetaryType();
paymentMonetary.currCode = currCode_Type.GBP;
paymentMonetary.Value = paymentValue;
//Payment data object
PaymentDataType paymentData = new PaymentDataType();
paymentData.PaymentCode = PaymentCodeType.Item20;
paymentData.PaymentAmount = paymentMonetary;
//return paymentData;
//Account action
accountActionData.AccountRef = accountRef;
accountActionData.Action = ActionType.New;
//Account information array
//AccountData(paymentData, contactInfo, accountActionData, accountData, accountHolderType);
object[] accountItems = new object[] { accountActionData, accountNumber, paymentData, accountHolderType, contactInfo };
accountData.Items = accountItems;
ItemsChoiceType[] accountFieldNames = new ItemsChoiceType[] { ItemsChoiceType.AccountAction, ItemsChoiceType.AccountNumber, ItemsChoiceType.PaymentData, ItemsChoiceType.AccountHolderType, ItemsChoiceType.Person };
accountData.ItemsElementName = accountFieldNames;
//Financial Information Return main array
//FIReturn(submissionData, fireturnActionData, accountData);
FIReturnType fireturn = new FIReturnType();
object[] fiItems = new object[] { fireturnActionData, fiRegisterID, dueDilligenceInd, thresholdInd, accountData };
fireturn.Items = fiItems;
ItemsChoiceType1[] fiFieldnames = new ItemsChoiceType1[] { ItemsChoiceType1.FIReturnAction, ItemsChoiceType1.FIRegisterId, ItemsChoiceType1.DueDiligenceInd, ItemsChoiceType1.ThresholdInd, ItemsChoiceType1.AccountData };
fireturn.ItemsElementName = fiFieldnames;
FIReturnType[] fiData = new FIReturnType[] { fireturn };
//Map FI return data to submissionData
submissionData.FIReturn = fiData;
//Serialize the submission close the TextWriter
serializer.Serialize(writer, fatcaSub);
writer.Close();
Process.Visible = false;
MessageBox.Show("Processing Complete!", "Complete", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
Close();
The problem is that I would like fireturn to appear in the document more than once from a dataset. If I changed my code to this:
FIReturnType[] fiData = new FIReturnType[] { fireturn, fireturn, fireturn };
//Map FI return data to submissionData
submissionData.FIReturn = fiData;
I am able to get the three elements as required. How can I change my code to allow for a foreach statement for example?I managed to change FIReturnType into a list as below. I have a sample datatable also. My code now creates the nodes as expected but the all contain the last item only. What do I need to change so that I get the correct values written?
DataTable dtTable = new DataTable();
dtTable.Columns.Add("FirstName", typeof(string));
dtTable.Columns.Add("Surname", typeof(string));
// Here we add five DataRows.
dtTable.Rows.Add("Test", "Test");
dtTable.Rows.Add("Two", "Three");
dtTable.Rows.Add("Four", "Five");
dtTable.Rows.Add("Six", "Seven");
dtTable.Rows.Add("Eight", "Nine");
List<FIReturnType> fiRetList = new List<FIReturnType>();
foreach (DataRow row in dtTable.Rows)
object fName = row["FirstName"];
object sName = row["Surname"];
contactInfo.FirstName = fName.ToString();
contactInfo.LastName = sName.ToString();
FIReturnType fireturn = new FIReturnType();
object[] fiItems = new object[] { fireturnActionData, fiRegisterID, dueDilligenceInd, thresholdInd, accountData };
fireturn.Items = fiItems;
ItemsChoiceType1[] fiFieldnames = new ItemsChoiceType1[] { ItemsChoiceType1.FIReturnAction, ItemsChoiceType1.FIRegisterId, ItemsChoiceType1.DueDiligenceInd, ItemsChoiceType1.ThresholdInd, ItemsChoiceType1.AccountData };
fireturn.ItemsElementName = fiFieldnames;
fiRetList.Add(new FIReturnType { Items = fiItems, ItemsElementName = fiFieldnames });
FIReturnType[] fiData = fiRetList.ToArray();
submissionData.FIReturn = fiData;
Maybe you are looking for
-
M-Series Buffered Event Counting with DMA -- gating problem
Hi -- I am implementing DMA-based buffered event counting on a PCIe-6259 board. I use G0_Out as the gate for G1, which counts events on a PFI pin. So by setting the speed of G0, I get an event count (either cumulative or non-cumulative) on a perio
-
Flex 4.6 mobile - open WebView in a Group...
Hello everyone ... I would like to open WebView in a "Group" how to do??? i have see one example: private var webView:StageWebView = new StageWebView(); public function StageWebViewExample()
-
Can't access the licensing site
Hi, I just bought an upgrade to CS6. I have the link to the licensing site, but it won't let me in! I tried resetting my password, but it never sends the email. Can you help?
-
Why do I have to sign in every time i want to read
Why do I have to sign into iBooks every time I want to read, especially if I'm in the middle of a book.
-
Hi all i am struggling to take the print in webdynpro SO for, i have tried the following code using your valuable help Pls Guide me futher more.Nobody giving correct solution so for i.e Step by Step from the beginning itself pls help us in this regar