XML

Syndicate content 15 

One useful feature of our REST framework is the ability for a dispatch class to identify request prefixes and forward them to another dispatch class. This approach of modularizing your URL map will improve code readability, enable you to easily maintain separate versions of an interface, and provide a means to protect API calls that only certain users will be allowed to access.

Overview

To set up a REST Service on your Caché instance, you need to define a dedicated CSP application and create the associated dispatch class that handles incoming requests. The dispatch class extends %CSP.REST and will include an XData block that contains your URL map. This tells the system which method to call when a particular request is received.

For example

0 2
0

comments

1429

views

+ 7

rating

This is a translation of the following article. Thanks @Evgeny Shvarov  for the help in translation.

Let's assume that you wrote a program that shows "Hello World!", for example:

  write "Hello, World!"

The program works and everyone is happy.

With time, however, your program becomes more complex, gets more features and you eventually need to show the same string in different languages. Moreover you don't know the number and names of these languages.

The spoiler below contains a description of how the task of multi-language localization is solved in Caché.

Last comment 20 May 2017
0 1
295

views

+ 7

rating

The task of handling office documents, namely docx documents, xlsx tables and pptx presentations is quite complicated. This article offers a way to parse, create and edit documents using only XSLT and ZIP.

Why? docx is the most popular document format, so the ability to generate and parse this format would always can be useful. The solution in a form of a ready-made library, can be problematic for several reasons:

  • library may not exist
  • you do not need another black box in your project
  • library restrictions : platforms, features, etc.
  • licensing
  • processing speed

In this article, I would use only basic tools for work with the docx documents.

Last comment 3 March 2017
0 0
2254

views

+ 5

rating

XDATA is used for a whole host of ISC libraries to store things like Zen pages, BPL logic and DTL transformations.

XDATA is the equivalent of XML config files of the JAVA world and JSON config files of the JavaScript / NPM world.

Whilst Atelier looks to shift source code to the disk, XDATA will remain a key component to source control our projects config / meta data.

I come across many developers who overlook XDATA, seeing it as an internal function of Cache and Ensemble and instead use globals to move meta data around, I've been there myself.

It might be because XDATA can feel a little clumsy to use, so here is an approach that I use that makes working with XDATA a breeze

Last comment 7 September 2017
0 4
459

views

+ 3

rating

I would like to write some code to parse a set of HTML pages from the internet in order to gather information from each web page.

All of the web pages are generated using a template, so the format of each of the web-pages is consistent with one-another and the information that I want to gather is always located in the same logical place within the page.

What is the best way to parse an html page in order to gather information at a specific place?

Can XML XPATH be used here?  Does anyone have any examples of parsing HTML content?

 

Last answer 1 June 2016 Last comment 15 December 2017
0 2
770

views

+ 2

rating

I am validating a v3 document against one xsd and using %XML.SAX.ContentHandler class . My requirment is to find the xpath of the error location. There is no method which does it.

I can find the line and offset using LocatePosition method. 

Can someone help me on this.

Thanks 

Suman

Last answer 12 days ago
0 2
0

comments

80

views

+ 1

rating

I interested on how others feel on this subject.  In general terms when you have a class that extends from %XML.Adaptor and you call XMLExport no validation is automatically done as part of the XMLExport process.  As an example if you do the following

 

SAMPLES>S tPatient=##Class(Sample.Person).%New()
 
SAMPLES>Set tPatient.Name="asdfghjklqwrrrrokkfkljbvkfbjflkbjflkbjblkjblkjdblkjblkcn l nn klkjdfkbjdlkbjlkbj"

SAMPLES>w tPatient.XMLExport(,",indent")
<Person>
  <Name>asdfghjklqwrrrrokkfkljbvkfbjflkbjflkbjblkjblkjdblkjblkcn l nn klkjdfkbjdlkbjlkbj</Name>
</Person>

Last answer 14 April 2016 Last comment 14 April 2016
0 1
353

views

+ 1

rating

I am using studio 2015 version which does not have dynamic objects and I need to read xml and convert that to a json I have managed to come close to json string but with little difficulties .I need to be able to identify the root element and specify where to put braces between objects  anyone  with any idea is welcome he is my code so far

Last answer 1 December 2017 Last comment 4 December 2017
0 1
488

views

+ 1

rating

HealthShare HealthConnect and Information Exchange version 15.03 support import transformations from C-CDA 2.1 to SDA. You can find these transforms in your installation's csp/xslt/SDA3 directory. For general information about import transforms, see "CDA Documents and XSL Transforms in HealthShare" in Overview of Health Connect.

Among the enhancements to import functionality added in connection with C-CDA 2.1 support is the ability to preprocess your C-CDA input files prior to the transformation done for import.

Preprocessing support can greatly simplify and reduce total processing time for transformations. Some possible use cases are

0 1
0

comments

400

views

0

rating

hi,

1. Created a class(test) and added a classmethod(checkdata).

2. Assigned a object with xml.

3. Created a new class for response and initialized in classmethod(checkdata). 

4. Created a new class for request parsing with list of object parameter.

5. While parsing xml in request for list of object,  the  result count is "0". But the xml has value for "2" object list.

6. XML has follow:

<Request>
    <party>
        <to name=""mohan"" address1=""India""  />
        <to  name=""sujay"" address1=""USA"  />
    </party>
</Request>
Last answer 31 October 2016 Last comment 19 October 2016
0 3
394

views

0

rating

I have a class extends %Persistent & %XML.Adaptor

It has 100 properties for example

Now I do intend to create a xml schema that I can import in Ensemble->XMLSchemas 

I did try to use XMLExportToString and %XMLWriter.GetXMLString

but didn't give me a proper schema. May be I am missing some small step

Can someone pls help

Last answer 19 September 2018
0 1
0

comments

70

views

0

rating

Hi,

I'm new with writing Caché Objectscript so I need some assistance. I have XML which contains information like this:

<?xml version="1.0" encoding="UTF-8"?>
<session>
   <sessionId>124364</sessionId>
   <cabinet>demo</cabinet>
   <eventType>IN</eventType>
   <eventTime>20161006160154</eventTime>
   <login>test</login>
   <loginFirstName>test</loginFirstName>
   <loginLastName>test</loginLastName>
</session>

I have a class representing this object as follows

Last answer 31 October 2016 Last comment 1 November 2016
0 0
599

views

0

rating

I have an xml file that I read into objects and I am trying to print that file back in nested xml anyone with idea on how that can be achieved or where I can read in order to achieve this, here is an example of what I am trying to do.

From this

<Root>
  <FamilyMembers>
  <familyName>
  </familyName>
  <Name>
  </Name>
  <Age>
  </Age>
  <Employment>
  </Employment>
  </FamilyMembers>
</Root>

To this

<?xml version="1.0" encoding="UTF-8"?>
<Root>
  <FamilyMembers>
      <Family>
     <familyName>
        </familyName>
      </Family>
    <Name>
    </Name>
    <Age>
    </Age>
    <Employment>
    </Employment>
  </FamilyMembers>
</Root>

Last answer 10 October 2017 Last comment 10 October 2017
0 1
288

views

0

rating

I have an Ens.StreamContainer which holds XML that was received, and I need to validate that against an XSD schema. The schema is very simple, only looking at the root element and maybe a couple other items to ensure the XML is what we expect before continuing the data flow.

I have imported my XSD into the Ensemble XSD wizard, so it is available, but I'm struggling to find a method that does the validation. I thought about possibly using the schema to generate a class definition, then attempt to load the XML as that object (try/catch to handle the failure scenario), but I don't know where to start on that either.

I have looked at %XML.Schema and EnsLib.EDI.XML.Schema classes, to no avail, but I believe I'm probably missing something.

Thanks in advance!

Last answer 1 November 2018
0 2
0

comments

81

views

0

rating

Hi all,

I'm trying to convert a HL7 section to a XML or JSON string.

We need to save the content of PID section into a SQL Column, therefore we need to convert it into a XML o JSON string

is there any easy way to convert it?

I've tried to convert it directly into a DTL, but all my attempts have been unsuccessful

Best regards,

Francisco Lopez

Last answer 22 December 2016 Last comment 20 December 2016
0 0
480

views

0

rating

I  have a business service that brings in a xml virtual document to the production and also a csv service  that brings in a csv file and have a process that transforms both to a xml output  but I have a problem with the csv as it is giving me this error when I try to trans form it ```ERROR <Ens>ErrException: <PROPERTY DOES NOT EXIST>zOnRequest+1 ^EnsLib.MsgRouter.VDocRoutingEngine.1 *DocType``` I have read here followed the suggestion but now I do not get any errors but my message is not being routed here is the rule set that I am usin

Last answer 12 October 2017 Last comment 13 October 2017
0 1
204

views

0

rating

I have used Studio's schema wizard to create classes representing my XML structure as defined in an xsd file and then I use the main class of that set of classes as parameter in my Ensemble web service.

 

Let's say I have a web method signature like this:

Method myMethod(message As My.Schema) As %String [ WebMethod ]

How do in that method take this message and convert it into a EnsLib.EDI.XML.Document

Last comment 21 February 2018
0 3
0

answers

243

views

0

rating

Hello devs,

I'm facing an issue with one of my business services, which basically grabs a XML from a webservice (which in turn reads the data from the caché database) and does some processing afterwards. The XML content (which is formed of some of the table fields values) contains a special character: (left single quote)

Last answer 26 January 2017 Last comment 26 January 2017
0 3
516

views

0

rating

I am trying to read a csv file and transfer it to a XML file without storing the objects to a database I have this code here doing the reading and have another method transferring the object read to a file but the reading one reads fine when it comes to the converting one I run to problems nothing happens any help appreciate

Last answer 13 October 2017 Last comment 13 October 2017
0 2
309

views

0

rating

Hello guys,

Based on this article (others as well, but this is the relevant one): http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...

I have been playing around with the Management Portal deployment tool, which involves:
Ensemble > Manage > Deployment Changes > Deploy and
Production Settings > Actions > Export
Production Settings > Actions > Re-Export

Everything was going fine , until I came across this:

- For the default settings, once I include them in the final xml and deploy the package into another production, by checking the default settings screen to the new production, I spotted that the the original production name remains there. This is useless for me, because I was expecting the settings to now be tied up to the new production. Is this an expected behaviour

Last answer 22 February 2018 Last comment 17 July 2018
0 2
185

views

0

rating

For each instance of an XML-enabled class I want to control whether a property is projected as an empty element or not projected at all. With string properties, I can set the value as $c(0) for an empty element, or an empty string for no projection. But it looks like this isn't consistent for properties with type %Boolean or %Integer. With booleans $c(0) gets projected as "false". With integers $c(0) stays as a zero-width space in the XML output (which gives me a SAX parser error if I try to read it).

Is there a way to do this that works for all datatype properties?

Last answer 21 November 2018 Last comment 20 November 2018
0 2
76

views

0

rating